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

Broken SQLite API: PRAGMA index_info returns SQL_PARSE_ERROR #900

Closed
ishefi opened this issue Jan 15, 2024 · 4 comments · Fixed by #918
Closed

Broken SQLite API: PRAGMA index_info returns SQL_PARSE_ERROR #900

ishefi opened this issue Jan 15, 2024 · 4 comments · Fixed by #918
Labels
bug Something isn't working

Comments

@ishefi
Copy link

ishefi commented Jan 15, 2024

alembic 1.13.1
SQLAlchemy 2.0.25
sqlalchemy-libsql 0.1.0

I encountered this when trying to run alembic revision --autogenerate on my turso instance, it raised the following error:

sqlalchemy.exc.DatabaseError: (sqlite3.DatabaseError) SQL_PARSE_ERROR: SQL string could not be parsed: unsupported statement: PRAGMA main.index_info(sqlite_autoindex_userhistory_1);
[SQL: PRAGMA main.index_info(sqlite_autoindex_userhistory_1);]

I also tried running it directly, the same error was raised:

import sqlalchemy
engine = sqlalchemy.create_engine(...)
with engine.connect() as conn:
    conn.execute(sqlachemy.text("PRAGMA main.index_info('sqlite_autoindex_userhistory_1');"))

tried both with and without the main. prefix.

This syntax is part of the SQLite API

The equivalent SELECT * FROM pragma_index_info('sqlite_autoindex_userhistory_1'); works, but this is not what used by alembic.

@jedafeza
Copy link

jedafeza commented Jan 20, 2024

I have the same problem, Do you have a solution?

@jedafeza
Copy link

image

@penberg penberg added the bug Something isn't working label Jan 22, 2024
@penberg
Copy link
Collaborator

penberg commented Jan 22, 2024

@MarinPostma @psarna Is this a limitation in the libSQL server parser?

@penberg
Copy link
Collaborator

penberg commented Jan 22, 2024

@ishefi @jedafeza This is a bug in the libSQL server parser, pull request #918 ought to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants