Comments (7)
I'm seeing this error too: https://github.com/simonw/simonwillisonblog-backup/actions/runs/4108524950/jobs/7089316644
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1410, in execute
meth = statement._execute_on_connection
AttributeError: 'str' object has no attribute '_execute_on_connection'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.10.9/x64/bin/db-to-sqlite", line 8, in <module>
sys.exit(cli())
File "/opt/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/opt/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/opt/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/opt/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/opt/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/db_to_sqlite/cli.py", line 112, in cli
results = db_conn.execute("select * from {}".format(table_quoted))
File "/opt/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1412, in execute
raise exc.ObjectNotExecutableError(statement) from err
sqlalchemy.exc.ObjectNotExecutableError: Not an executable object: 'select * from "auth_permission"'
from db-to-sqlite.
I bet this is related to SQLAlchemy 2: https://docs.sqlalchemy.org/en/14/changelog/migration_20.html
% pip freeze | grep SQ
SQLAlchemy==2.0.1
from db-to-sqlite.
Running this fixes the errors:
pip install 'SQLAlchemy<2.0'
from db-to-sqlite.
With SQLAlchemy 1.4 installed I can run this to see migration hints:
SQLALCHEMY_WARN_20=1 pytest
I get back 41 warnings:
tests/test_db_to_sqlite.py: 41 warnings
tests/test_redact.py: 12 warnings
/Users/simon/Dropbox/Development/db-to-sqlite/db_to_sqlite/cli.py:112: RemovedIn20Warning: Passing a string to Connection.execute() is deprecated and will be removed in version 2.0. Use the text() construct, or the Connection.exec_driver_sql() method to invoke a driver-level SQL string. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
results = db_conn.execute("select * from {}".format(table_quoted))
tests/test_db_to_sqlite.py: 43 warnings
tests/test_redact.py: 12 warnings
/Users/simon/Dropbox/Development/db-to-sqlite/db_to_sqlite/cli.py:186: RemovedIn20Warning: The Row.keys() method is considered legacy as of the 1.x series of SQLAlchemy and will be removed in 2.0. Use the namedtuple standard accessor Row._fields, or for full mapping behavior use row._mapping.keys() (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
d = dict(row)
tests/test_db_to_sqlite.py: 134 warnings
tests/test_redact.py: 36 warnings
/Users/simon/Dropbox/Development/db-to-sqlite/db_to_sqlite/cli.py:114: RemovedIn20Warning: Using non-integer/slice indices on Row is deprecated and will be removed in version 2.0; please use row._mapping[<key>], or the mappings() accessor on the Result object. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
rows = (redacted_dict(r, redact_these) for r in results)
tests/test_db_to_sqlite.py::test_specific_tables[postgresql://localhost/test_db_to_sqlite]
tests/test_db_to_sqlite.py::test_specific_tables[postgresql://localhost/test_db_to_sqlite]
tests/test_db_to_sqlite.py::test_specific_tables[postgres://localhost/test_db_to_sqlite]
tests/test_db_to_sqlite.py::test_specific_tables[postgres://localhost/test_db_to_sqlite]
/Users/simon/Dropbox/Development/db-to-sqlite/db_to_sqlite/cli.py:109: RemovedIn20Warning: Passing a string to Connection.execute() is deprecated and will be removed in version 2.0. Use the text() construct, or the Connection.exec_driver_sql() method to invoke a driver-level SQL string. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
count = db_conn.execute(
tests/test_db_to_sqlite.py::test_sql_query[postgresql://localhost/test_db_to_sqlite]
tests/test_db_to_sqlite.py::test_sql_query[postgres://localhost/test_db_to_sqlite]
/Users/simon/Dropbox/Development/db-to-sqlite/db_to_sqlite/cli.py:170: RemovedIn20Warning: Passing a string to Connection.execute() is deprecated and will be removed in version 2.0. Use the text() construct, or the Connection.exec_driver_sql() method to invoke a driver-level SQL string. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
results = db_conn.execute(sql)
tests/test_db_to_sqlite.py::test_sql_query[postgresql://localhost/test_db_to_sqlite]
tests/test_db_to_sqlite.py::test_sql_query[postgresql://localhost/test_db_to_sqlite]
tests/test_db_to_sqlite.py::test_sql_query[postgres://localhost/test_db_to_sqlite]
tests/test_db_to_sqlite.py::test_sql_query[postgres://localhost/test_db_to_sqlite]
/Users/simon/Dropbox/Development/db-to-sqlite/db_to_sqlite/cli.py:171: RemovedIn20Warning: The Row.keys() method is considered legacy as of the 1.x series of SQLAlchemy and will be removed in 2.0. Use the namedtuple standard accessor Row._fields, or for full mapping behavior use row._mapping.keys() (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
rows = (dict(r) for r in results)
tests/test_db_to_sqlite.py::test_sql_query[postgresql://localhost/test_db_to_sqlite]
tests/test_db_to_sqlite.py::test_sql_query[postgresql://localhost/test_db_to_sqlite]
tests/test_db_to_sqlite.py::test_sql_query[postgresql://localhost/test_db_to_sqlite]
tests/test_db_to_sqlite.py::test_sql_query[postgresql://localhost/test_db_to_sqlite]
tests/test_db_to_sqlite.py::test_sql_query[postgres://localhost/test_db_to_sqlite]
tests/test_db_to_sqlite.py::test_sql_query[postgres://localhost/test_db_to_sqlite]
tests/test_db_to_sqlite.py::test_sql_query[postgres://localhost/test_db_to_sqlite]
tests/test_db_to_sqlite.py::test_sql_query[postgres://localhost/test_db_to_sqlite]
/Users/simon/.local/share/virtualenvs/db-to-sqlite-Nk_u3PUs/lib/python3.10/site-packages/sqlite_utils/db.py:3604: RemovedIn20Warning: Using non-integer/slice indices on Row is deprecated and will be removed in version 2.0; please use row._mapping[<key>], or the mappings() accessor on the Result object. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
for record in records:
from db-to-sqlite.
Doing this fixes the warnings about .execute()
:
from sqlalchemy import text
# ...
results = db_conn.execute(text(sql))
from db-to-sqlite.
Finally got the tests to pass in:
from db-to-sqlite.
Thank you @simonw !
from db-to-sqlite.
Related Issues (20)
- Switch CI to GitHub Actions HOT 9
- Can't load plugin: sqlalchemy.dialects:postgres HOT 4
- Is it possible to export from a SQLite database?
- Views, Materialized Views, Functions not exported from Postgres database to SQLite file HOT 1
- TZ flag for migrating datetime columns?
- Multiple Postgres Schemas?
- Add option for selecting tables to copy by a (regex) pattern HOT 1
- SQLite version supporting the RETURNING clause
- SQLite version supporting the RETURNING clause #42
- sqlite3.OperationalError: table sqlite_master may not be modified
- Some of the tests are hanging in CI HOT 12
- Is it possible to create PostgreSQL views in the SQLite database?
- MySQL bool columns end up as SQLite BLOB columns upon conversion
- MySQL tests fail after multiple runs
- Is it possible to skip tables if they do not exist?
- Postgres JSONB columns are converted to Sqlite TEXT columns, not JSON
- ValueError
- Constraint Issue
- Feature Request: Translate Datetime to milliseconds since epoch
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from db-to-sqlite.