Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions clickhouse_connect/cc_sqlalchemy/dialect.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

from sqlalchemy import text
from sqlalchemy.engine.default import DefaultDialect

from clickhouse_connect import dbapi
Expand Down Expand Up @@ -46,8 +47,8 @@ def get_schema_names(connection, **_):

@staticmethod
def has_database(connection, db_name):
return (connection.execute('SELECT name FROM system.databases ' +
f'WHERE name = {format_str(db_name)}')).rowcount > 0
return (connection.execute(text('SELECT name FROM system.databases ' +
f'WHERE name = {format_str(db_name)}'))).rowcount > 0

def get_table_names(self, connection, schema=None, **kw):
cmd = 'SHOW TABLES'
Expand Down Expand Up @@ -87,7 +88,7 @@ def get_check_constraints(self, connection, table_name, schema=None, **kw):
return []

def has_table(self, connection, table_name, schema=None, **_kw):
result = connection.execute(f'EXISTS TABLE {full_table(table_name, schema)}')
result = connection.execute(text(f'EXISTS TABLE {full_table(table_name, schema)}'))
row = result.fetchone()
return row[0] == 1

Expand Down