user13520940
user13520940

Reputation: 143

sqlite insert function duplicate id error

I am trying to copy a dbf database into a sqlite database I have the following code

db=dataset.connect('sqlite:///:memory:')
table =db['table1']

for record in DBF(settings['xbasefile']):
    db['table1'].insert(record)

this loads the record but fails to insert with a datatype mismatch on the ID column because the row coming in has a format like

ID:text field1:Text

this function

table=db['table1']

seems to assume an int id for the table. Any way to get this to do an insert with the text id that is in the table?

Upvotes: 0

Views: 51

Answers (1)

user13520940
user13520940

Reputation: 143

Ended up using the dbf2sqlite utility which automatically creates the table with correct columns from the dbf

Upvotes: 0

Related Questions