diff --git a/target_duckdb/db_sync.py b/target_duckdb/db_sync.py index 1d41b5d..2c826e7 100644 --- a/target_duckdb/db_sync.py +++ b/target_duckdb/db_sync.py @@ -327,9 +327,9 @@ def table_name(self, stream_name, is_temporary=False, without_schema=False): if without_schema: return f'"{pg_table_name.lower()}"' elif self.catalog_name: - return f'{self.catalog_name}.{self.schema_name}."{pg_table_name.lower()}"' + return f'"{self.catalog_name}"."{self.schema_name}"."{pg_table_name.lower()}"' else: - return f'{self.schema_name}."{pg_table_name.lower()}"' + return f'"{self.schema_name}"."{pg_table_name.lower()}"' def record_primary_key_string(self, record): if len(self.stream_schema_message["key_properties"]) == 0: @@ -530,9 +530,9 @@ def create_schema_if_not_exists(self, table_columns_cache=None): if len(schema_rows) == 0: if catalog_name: - query = f"CREATE SCHEMA IF NOT EXISTS {catalog_name}.{schema_name}" + query = f'CREATE SCHEMA IF NOT EXISTS "{catalog_name}"."{schema_name}"' else: - query = f"CREATE SCHEMA IF NOT EXISTS {schema_name}" + query = f'CREATE SCHEMA IF NOT EXISTS "{schema_name}"' self.logger.info( "Schema '%s' does not exist. Creating... %s", schema_name, query