pudo / dataset

Easy-to-use data handling for SQL data stores with support for implicit table creation, bulk loading, and transactions.
https://dataset.readthedocs.org/
MIT License
4.76k stars 297 forks source link

Dataset ignore my primary key #414

Open ahvahsky2008 opened 1 year ago

ahvahsky2008 commented 1 year ago

Why dataset ignore my key? I wanna that acategory_id will be primary key, but it creates own pk (id field)

payload = {'acategory_id': 1, 'acategory_name': 'xxx'}
db['axixa'].upsert(payload, keys=['acategory_id'])

image

pudo commented 1 year ago

I think you can just specify the primary key column you want to use via get_table: https://dataset.readthedocs.io/en/latest/api.html#dataset.Database.get_table

ahvahsky2008 commented 1 year ago

I guess why pudo doesn't create my pk

pudo commented 1 year ago

??