Skip to content

Commit da31d2b

Browse files
authored
Merge pull request Altinity#156 from bookin/patch-1
Fix error File not found
2 parents da6e608 + 0f4b91a commit da31d2b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

clickhouse_mysql/tablemigrator.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# -*- coding: utf-8 -*-
33

44
import logging
5+
import os.path
56

67
from MySQLdb.cursors import SSDictCursor,Cursor
78
from clickhouse_mysql.tableprocessor import TableProcessor
@@ -100,7 +101,11 @@ def __init__(
100101
db, table = TableProcessor.parse_full_table_name(full_table_name)
101102
if not db in self.where_clauses:
102103
self.where_clauses[db] = {}
103-
self.where_clauses[db][table] = open(where_file_name, 'r').read().strip("\n")
104+
105+
if os.path.isfile(where_file_name):
106+
self.wheres[db][table] = open(where_file_name,'r').read().strip("\n")
107+
else:
108+
self.wheres[db][table] = where_file_name
104109

105110
# debug info
106111
logging.info("migration where clauses")

0 commit comments

Comments
 (0)