如何在 Python 3 中使用 klepto sqltable_archive 设置 table 名称?

How to set a table name using klepto sqltable_archive in Python 3?

基于klepto docs

使用:

klepto.archives.sqltable_archive('sqlite:///foo.db', cached=False)

成功创建了默认 table 名称为 memo

的数据库

但是,当table也包括在内时:

klepto.archives.sqltable_archive('sqlite:///foo.db', table='bar', cached=False)

出现以下错误:

  line 159, in __new__
    archive = _sqltable_archive(db, table, **kwds)
TypeError: __init__() got multiple values for argument 'table'

指向 line 159 klepto.archives

非常感谢任何帮助!

我是 klepto 作者。抱歉,那里的文档不清楚。如果您查看 (i.e. line 158) 上面的行,您会看到 table 名称是使用关键字 name... 设置的,然后拆分为 db 名称和 table 名字。我想当 table 作为关键字参数给出时我可以抛出更好的错误。