我想从Python中的mongo集合在duckdb数据库中创建一个表,以进行进一步分析。现在我执行以下操作:
with open(f"mongo_json.jsonl", "w") as file:
json.dump(list(mongo_cursor), file, default=str)
duckdb.sql(f"CREATE OR REPLACE TABLE mongo_table AS SELECT *, FROM read_json_auto('mongo_json.jsonl', IGNORE_ERRORS=true)")
但问题是 json 确实很大,这增加了内存消耗。那么有没有什么想法或更好的方法来实现这一目标?