diff --git a/clickhouse_mysql/clioptions.py b/clickhouse_mysql/clioptions.py index 4be23a2..fef6d9e 100644 --- a/clickhouse_mysql/clioptions.py +++ b/clickhouse_mysql/clioptions.py @@ -148,6 +148,7 @@ class CLIOptions(Options): 'dst_table': None, 'dst_table_prefix': None, 'dst_create_table': False, + 'dst_secure_connection': False, # # converters section @@ -468,6 +469,11 @@ def options(self): action='store_true', help='Prepare and run CREATE TABLE SQL statement(s).' ) + argparser.add_argument( + '--dst-secure-connection', + action='store_true', + help='Establish secure connection.' + ) # # converters section @@ -563,6 +569,7 @@ def options(self): 'dst_table': args.dst_table, 'dst_table_prefix': args.dst_table_prefix, 'dst_create_table': args.dst_create_table, + 'dst_secure_connection': args.dst_secure_connection, # # converters section diff --git a/clickhouse_mysql/config.py b/clickhouse_mysql/config.py index e4551c8..d45c027 100644 --- a/clickhouse_mysql/config.py +++ b/clickhouse_mysql/config.py @@ -118,6 +118,7 @@ def __init__(self): 'port': self.options.get_int('dst_port'), 'user': self.options['dst_user'], 'password': self.options['dst_password'], + 'secure': self.options['dst_secure_connection'], }, 'dst_schema': self.options['dst_schema'], 'dst_distribute': self.options['dst_distribute'], @@ -149,6 +150,7 @@ def __init__(self): 'port': self.options.get_int('dst_port'), 'user': self.options['dst_user'], 'password': self.options['dst_password'], + 'secure': self.options['dst_secure_connection'], }, 'dst_schema': self.options['dst_schema'], 'dst_distribute': self.options['dst_distribute'], @@ -196,6 +198,7 @@ def __init__(self): 'port': self.options.get_int('dst_port'), 'user': self.options['dst_user'], 'password': self.options['dst_password'], + 'secure': self.options['dst_secure_connection'], }, 'dst_schema': self.options['dst_schema'], 'dst_distribute': self.options['dst_distribute'], @@ -386,6 +389,7 @@ def writer_builder_chwriter(self): 'port': self.config['writer']['clickhouse']['connection_settings']['port'], 'user': self.config['writer']['clickhouse']['connection_settings']['user'], 'password': self.config['writer']['clickhouse']['connection_settings']['password'], + 'secure': self.config['writer']['clickhouse']['connection_settings']['secure'], }, 'dst_schema': self.config['writer']['clickhouse']['dst_schema'], 'dst_table': self.config['writer']['clickhouse']['dst_table'], diff --git a/clickhouse_mysql/dbclient/chclient.py b/clickhouse_mysql/dbclient/chclient.py index c2a5329..5da124b 100644 --- a/clickhouse_mysql/dbclient/chclient.py +++ b/clickhouse_mysql/dbclient/chclient.py @@ -35,6 +35,3 @@ def verify_connection_settings(self, connection_settings): if not connection_settings['port']: logging.critical("Need CH port in connection settings") sys.exit(0) - -#self.client = CHClient(connection_settings) -#self.client.execute(sql, rows) diff --git a/clickhouse_mysql/writer/chwriter.py b/clickhouse_mysql/writer/chwriter.py index 587d48f..2439ed9 100644 --- a/clickhouse_mysql/writer/chwriter.py +++ b/clickhouse_mysql/writer/chwriter.py @@ -118,7 +118,8 @@ def insert(self, event_or_events=None): 'host': '192.168.74.230', 'port': 9000, 'user': 'default', - 'passwd': '', + 'password': '', + 'secure': False, } writer = CHWriter(connection_settings=connection_settings) diff --git a/docs/manual.md b/docs/manual.md index a064842..3025553 100644 --- a/docs/manual.md +++ b/docs/manual.md @@ -341,6 +341,7 @@ $PYTHON clickhouse-mysql ${*:1} \ --src-host=127.0.0.1 \ --src-user=root \ --dst-host=127.0.0.1 \ + --dst-secure-connection \ --csvpool \ --csvpool-file-path-prefix=qwe_ \ --mempool-max-flush-interval=60 \ @@ -357,6 +358,7 @@ Options description * `--src-host=127.0.0.1` - MySQL source host * `--src-user=root` - MySQL source user (remember about PRIVILEGES for this user) * `--dst-host=127.0.0.1` - ClickHouse host + * `--dst-secure-connection` - establish secure connection with clickhouse * `--csvpool` - make pool of csv files (assumes `--mempool` also) * `--csvpool-file-path-prefix=qwe_` - put these CSV files having `qwe_` prefix in `CWD` * `--mempool-max-flush-interval=60` - flush mempool at least every 60 seconds diff --git a/setup.py b/setup.py index f5be528..45e00d9 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ name="clickhouse-mysql", # version should comply with PEP440 - version='0.0.20200128', + version='0.0.20230201', description='MySQL to ClickHouse data migrator', long_description='MySQL to ClickHouse data migrator',