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

Able to create tables even when ensure_schema is True #342

Closed achillesrasquinha closed 4 years ago

achillesrasquinha commented 4 years ago

If you attempt to execute the following:

import dataset

db = dataset.connect(ensure_schema=True)
db['Foo'].insert({ 'foo': 'bar' })

ends up creating Foo and inserting the data. Is this the required behaviour?

pudo commented 4 years ago

Yes. ensure_schema in dataset means "make sure the schema is as needed to store the given data, create it if needed". Try the opposite setting to disable automatic schema creation.

achillesrasquinha commented 4 years ago

Works! Closing this.