Skip to content

Commit

Permalink
Merge pull request #21 from Infinipoint/quoting-fix
Browse files Browse the repository at this point in the history
Add quotes around db & cluster name to allow full range of identifiers
  • Loading branch information
zifter authored Oct 5, 2023
2 parents f8c34bb + 652eaea commit 1ba90ba
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/clickhouse_migrations/clickhouse_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ def connection(self, db_name: str) -> Client:
def create_db(self, db_name, cluster_name=None):
with self.connection("") as conn:
if cluster_name is None:
conn.execute(f"CREATE DATABASE IF NOT EXISTS {db_name}")
conn.execute(f'CREATE DATABASE IF NOT EXISTS "{db_name}"')
else:
conn.execute(
f"CREATE DATABASE IF NOT EXISTS {db_name} ON CLUSTER {cluster_name}"
f'CREATE DATABASE IF NOT EXISTS "{db_name}" ON CLUSTER "{cluster_name}"'
)

def init_schema(self, db_name, cluster_name=None):
Expand Down

0 comments on commit 1ba90ba

Please sign in to comment.