Skip to content

Commit 73a818d

Browse files
authored
Apply quotes in USE statement (bakwc#88)
1 parent cb6570a commit 73a818d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mysql_ch_replicator/mysql_api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def reconnect_if_required(self, force=False):
3939
raise
4040
self.cursor = self.db.cursor()
4141
if self.database is not None:
42-
self.cursor.execute(f'USE {self.database}')
42+
self.cursor.execute(f'USE `{self.database}`')
4343
self.last_connect_time = curr_time
4444

4545
def drop_database(self, db_name):
@@ -63,7 +63,7 @@ def set_database(self, database):
6363
self.reconnect_if_required()
6464
self.database = database
6565
self.cursor = self.db.cursor()
66-
self.cursor.execute(f'USE {self.database}')
66+
self.cursor.execute(f'USE `{self.database}`')
6767

6868
def get_databases(self):
6969
self.reconnect_if_required(True) # New database appear only after new connection

0 commit comments

Comments
 (0)