简体   繁体   中英

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

Based on the klepto docs

Using:

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

Successfully creates a database with the default table name of memo

However, when table is also included:

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

The following error occurs:

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

pointing to line 159 in klepto.archives

Any help is much appreciated!

I'm the klepto author. Sorry the docs are not clear there. If you look at the line above (ie line 158) , you'll see that the table name is set with the keyword name ... which then gets split into the db name and the table name. I guess I could throw a better error when table is given as a keyword argument.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM