使用Connectorx读取Sql表



我正在使用connectorX库读取sql表并保存为csv,但遇到了奇怪的错误代码是

import connectorx as cx
MYSQL_READER_HOST = cfg.sql['host']
MYSQL_READER_USERNAME = cfg.sql['user']
MYSQL_READER_PASSWORD = cfg.sql['passwd']
MYSQL_DB_NAME = cfg.sql['db']
tables = ['table1','table2']
for table in tables:               #line 52 of my code
print(f't => t Storing {table}')
query = "select /*+ MAX_EXECUTION_TIME(100000000) */ * from "+ table+";"

table = cx.read_sql(f'mysql://{MYSQL_READER_USERNAME}:{MYSQL_READER_PASSWORD}@{MYSQL_READER_HOST}/{MYSQL_DB_NAME}' ,query,partition_num=10)
table.to_csv(os.path.join(store_dir, table + '.csv'), index=False)

我面对的错误

Fatal Python error: none_dealloc: deallocating None
Python runtime state: initialized
Current thread 0x00003d60 (most recent call first):
File "C:UsersLunchONDesktopdownload_scriptutil_scriptsdata_download_connector_x.py", line 52 in <module>

你能试试版本>=吗0.2.4-alpha.4?这个问题应该已经解决了https://github.com/sfu-db/connector-x/issues/201

最新更新