-
-
Notifications
You must be signed in to change notification settings - Fork 299
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
connection schema handling on inserts #78
Comments
I am also experiencing this issue. Sorry I don't have anything more to add (Postgresql 9.3) |
Fixed in a95c7be |
Thanks! |
I'm still experiencing the same issue here. >>> db = dataset.connect(os.environ["DB_URL"], schema="1")
>>> table = db['person']
>>> print(table.columns)
['id']
>>> table.insert(dict(name='John Doe', age=46))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/Jens/Dropbox/journalism++/jsurveillance/Scraper/env/lib/python2.7/site-packages/dataset/persistence/table.py", line 72, in insert
self._ensure_columns(row, types=types)
File "/Users/Jens/Dropbox/journalism++/jsurveillance/Scraper/env/lib/python2.7/site-packages/dataset/persistence/table.py", line 214, in _ensure_columns
self.create_column(column, _type)
File "/Users/Jens/Dropbox/journalism++/jsurveillance/Scraper/env/lib/python2.7/site-packages/dataset/persistence/table.py", line 241, in create_column
Column(name, type)
File "/Users/Jens/Dropbox/journalism++/jsurveillance/Scraper/env/lib/python2.7/site-packages/alembic/operations.py", line 595, in add_column
schema=schema
File "/Users/Jens/Dropbox/journalism++/jsurveillance/Scraper/env/lib/python2.7/site-packages/alembic/ddl/impl.py", line 176, in add_column
self._exec(base.AddColumn(table_name, column, schema=schema))
File "/Users/Jens/Dropbox/journalism++/jsurveillance/Scraper/env/lib/python2.7/site-packages/alembic/ddl/impl.py", line 122, in _exec
return conn.execute(construct, *multiparams, **params)
File "/Users/Jens/Dropbox/journalism++/jsurveillance/Scraper/env/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1989, in execute
return connection.execute(statement, *multiparams, **params)
File "/Users/Jens/Dropbox/journalism++/jsurveillance/Scraper/env/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 914, in execute
return meth(self, multiparams, params)
File "/Users/Jens/Dropbox/journalism++/jsurveillance/Scraper/env/lib/python2.7/site-packages/sqlalchemy/sql/ddl.py", line 68, in _execute_on_connection
return connection._execute_ddl(self, multiparams, params)
File "/Users/Jens/Dropbox/journalism++/jsurveillance/Scraper/env/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 968, in _execute_ddl
compiled
File "/Users/Jens/Dropbox/journalism++/jsurveillance/Scraper/env/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1146, in _execute_context
context)
File "/Users/Jens/Dropbox/journalism++/jsurveillance/Scraper/env/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1341, in _handle_dbapi_exception
exc_info
File "/Users/Jens/Dropbox/journalism++/jsurveillance/Scraper/env/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 199, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb)
File "/Users/Jens/Dropbox/journalism++/jsurveillance/Scraper/env/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1139, in _execute_context
context)
File "/Users/Jens/Dropbox/journalism++/jsurveillance/Scraper/env/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 450, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) relation "person" does not exist
[SQL: 'ALTER TABLE person ADD COLUMN age INTEGER'] |
Yes, me too. I'm going to try and make a test for this. |
I can fix this one issue by specifying the schema in
However, running the complete test_persistence.py when connected to a specific postgres schema has more problems.
Sending a plain query text string fails unless table names in the string are schema qualified. This makes sense and https://stackoverflow.com/questions/9298296/sqlalchemy-support-of-postgres-schemas has some ideas on how to deal with it. I tried the to set the path via event listener but the test seems to be creating too many connections and postgres complains. Also, the test has failures like this when connected to postgres
Maybe just a setting somewhere in sqlalchemy or psycopg2 to get the query results accessible as properties but I'm leaving this for now. |
Hi all , wondering if you can help, i can't find how to specify the schema to make my inserts, im using postgres. Thank you for all the great work with dataset |
Fixed. |
On my postgresql database (9.3.2), executing the quickstart examples works when connection schema is not specified:
However, when connection schema is specified, the created table is not found when using
insert
- it seems to be looking instead in the currentsearch_path
:The text was updated successfully, but these errors were encountered: