Skip to content

Ministack: Free, open-source local AWS emulator - 60+ services, Terraform compatible, real databases. Free forever. MIT licensed.

fix(glue): return null LocationUri when not set, matching AWS/Localstack (#514)

Declan Currancd40ad754966
diff --git a/ministack/services/glue.py b/ministack/services/glue.py
index 06a1d51e..f46cfe68 100644
--- a/ministack/services/glue.py
+++ b/ministack/services/glue.py
@@ -192,7 +192,7 @@ def _create_database(data):
_databases[name] = {
"Name": name,
"Description": db_input.get("Description", ""),
- "LocationUri": db_input.get("LocationUri", ""),
+ "LocationUri": db_input.get("LocationUri"),
"Parameters": db_input.get("Parameters", {}),
"CreateTime": int(time.time()),
"CatalogId": get_account_id(),
diff --git a/tests/test_glue.py b/tests/test_glue.py
index 870795f0..ebb8b5c3 100644
--- a/tests/test_glue.py
+++ b/tests/test_glue.py
@@ -59,6 +59,15 @@ def test_glue_crawler(glue):
assert resp["Crawler"]["Name"] == "test-crawler"
glue.start_crawler(Name="test-crawler")
+def test_glue_database_location_uri(glue):
+ glue.create_database(DatabaseInput={"Name": "db_no_location"})
+ resp = glue.get_database(Name="db_no_location")
+ assert resp["Database"].get("LocationUri") is None
+
+ glue.create_database(DatabaseInput={"Name": "db_with_location", "LocationUri": "s3://my-bucket/warehouse/"})
+ resp = glue.get_database(Name="db_with_location")
+ assert resp["Database"]["LocationUri"] == "s3://my-bucket/warehouse/"
+
def test_glue_database_v2(glue):
glue.create_database(DatabaseInput={"Name": "glue_db_v2", "Description": "v2 DB"})
resp = glue.get_database(Name="glue_db_v2")