Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

creating tables via sqlalchemy model base in sqlite #25

Open
cdesyoun opened this issue Jan 20, 2016 · 1 comment
Open

creating tables via sqlalchemy model base in sqlite #25

cdesyoun opened this issue Jan 20, 2016 · 1 comment

Comments

@cdesyoun
Copy link
Contributor

I tried to create all of tables via ODM2 model base, like this:

from odm2api.base import *
modelBase.metadata.create_all(engine)

in current odm2 sqlalchemy model, because of table schema, "odm2", when creating tables in sqlite, I got the error message below:

sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) unknown database "odm2" [SQL: u'PRAGMA "odm2".table_info("samplingfeatureexternalidentifiers")']

When using the modified odm2 model for sqlite, https://github.com/ODM2/ODM2PythonAPI/blob/master/odm2api/ODM2/models_sqlite.py, it went well.
Is there any way to skip the schema tag in current odm2 sqlalchemy model for not supporting the schema in certain databases, sqlite, mySQL?

@horsburgh
Copy link
Member

@cdesyoun - I don't know the answer to this question, but I do know that @sreeder has had some similar issues with SQLite and I thought had figured out how to turn off the "odm2" schema for anything to do with SQLite. She will have to confirm. She's on maternity leave for a few more weeks.

In the meantime, to create an ODM2 SQLite database, you should use the blank schema script from the ODM2 repository for SQLite:

https://github.com/ODM2/ODM2/tree/master/src/blank_schema_scripts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants