Skip to content

Commit

Permalink
Do case-insensitive schema comparison before trying to create a schema
Browse files Browse the repository at this point in the history
  • Loading branch information
edmundyan committed Aug 5, 2019
1 parent b2f2e69 commit 265f6d3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions core/dbt/task/runnable.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,12 +316,14 @@ def create_schemas(self, adapter, selected_uids):

required_databases = set(db for db, _ in required_schemas)

existing_schemas = set()
existing_schemas_lowered = set()
for db in required_databases:
existing_schemas.update((db, s) for s in adapter.list_schemas(db))
existing_schemas_lowered.update(
(db.lower(), s.lower()) for s in adapter.list_schemas(db))

for database, schema in (required_schemas - existing_schemas):
adapter.create_schema(database, schema)
for db, schema in required_schemas:
if (db.lower(), schema.lower()) not in existing_schemas_lowered:
adapter.create_schema(db, schema)

def get_result(self, results, elapsed_time, generated_at):
return ExecutionResult(
Expand Down

0 comments on commit 265f6d3

Please sign in to comment.