Skip to content

Commit 714d94d

Browse files
authored
Strip db name from token in create table queries (#70) (#71)
1 parent b294c83 commit 714d94d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

mysql_ch_replicator/converter.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,9 @@ def parse_mysql_table_structure(self, create_statement, required_table_name=None
585585
if not isinstance(tokens[2], sqlparse.sql.Identifier):
586586
raise Exception('wrong create statement', create_statement)
587587

588-
structure.table_name = strip_sql_name(tokens[2].normalized)
588+
# get_real_name() returns the table name if the token is in the
589+
# style `<dbname>.<tablename>`
590+
structure.table_name = strip_sql_name(tokens[2].get_real_name())
589591

590592
if not isinstance(tokens[3], sqlparse.sql.Parenthesis):
591593
raise Exception('wrong create statement', create_statement)

0 commit comments

Comments
 (0)