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

BUG | Workflow "OperationalError: near "DROP": syntax error" #35

Open
v1a0 opened this issue Jun 19, 2021 · 2 comments
Open

BUG | Workflow "OperationalError: near "DROP": syntax error" #35

v1a0 opened this issue Jun 19, 2021 · 2 comments
Labels
bug Something isn't working or doesn't seems to work right help wanted Extra attention is needed

Comments

@v1a0
Copy link
Owner

v1a0 commented Jun 19, 2021

Workflow "Test Sqlite3x"

YML: .github/workflows/test_sqlite3x.yml

Running tests/new_test_all.py and falling with sqlite3.OperationalError: near "DROP": syntax error.

Falling function has_add_remove_column_test(), temporary #commented

Here is the log:

2021-06-19 04:00:01.512 | DEBUG    | sqllex.core.entities.sqlite3x.midleware:execute_wrapper:53 - 
CREATE  TABLE  't8'  (
id INTEGER ,
test TEXT 
) ;


2021-06-19 04:00:01.513 | DEBUG    | sqllex.core.entities.sqlite3x.midleware:execute_wrapper:53 - 
SELECT name FROM sqlite_master WHERE type='table'


2021-06-19 04:00:01.513 | DEBUG    | sqllex.core.entities.sqlite3x.midleware:execute_wrapper:53 - 
ALTER TABLE 't8' ADD 'col1' TEXT DEFAULT 123


2021-06-19 04:00:01.513 | DEBUG    | sqllex.core.entities.sqlite3x.midleware:execute_wrapper:53 - 
ALTER TABLE 't8' ADD 'col2' TEXT


2021-06-19 04:00:01.514 | DEBUG    | sqllex.core.entities.sqlite3x.midleware:execute_wrapper:53 - 
SELECT name FROM PRAGMA_TABLE_INFO('t8')


2021-06-19 04:00:01.514 | DEBUG    | sqllex.core.entities.sqlite3x.midleware:execute_wrapper:53 - 
SELECT name FROM PRAGMA_TABLE_INFO('t8')


2021-06-19 04:00:01.514 | DEBUG    | sqllex.core.entities.sqlite3x.midleware:execute_wrapper:53 - 
ALTER TABLE 't8' DROP COLUMN 'col2'


Traceback (most recent call last):
  File "/home/runner/work/sqllex/sqllex/new_test_all.py", line 423, in <module>
    has_add_remove_column_test()
  File "/home/runner/work/sqllex/sqllex/new_test_all.py", line 395, in has_add_remove_column_test
    t8.remove_column('col2')
  File "/home/runner/work/sqllex/sqllex/sqllex/core/entities/sqlite3x/sqlite3x.py", line 215, in remove_column
    self.db.remove_column(self.name, column)
  File "/home/runner/work/sqllex/sqllex/sqllex/core/entities/sqlite3x/sqlite3x.py", line 1417, in remove_column
    self.execute(
  File "/home/runner/work/sqllex/sqllex/sqllex/core/entities/sqlite3x/sqlite3x.py", line 1128, in execute
    return self._execute_stmt(script=script, values=values, request=request)
  File "/home/runner/work/sqllex/sqllex/sqllex/core/tools/convertors/listers.py", line 61, in t2l_wrapper
    ret = func(*args, **kwargs)
  File "/home/runner/work/sqllex/sqllex/sqllex/core/entities/sqlite3x/midleware.py", line 67, in execute_wrapper
    return executor(stmt.connection, stmt)
  File "/home/runner/work/sqllex/sqllex/sqllex/core/entities/sqlite3x/midleware.py", line 38, in executor
    raise error
  File "/home/runner/work/sqllex/sqllex/sqllex/core/entities/sqlite3x/midleware.py", line 33, in executor
    cur.execute(stmt.request.script)
sqlite3.OperationalError: near "DROP": syntax error
Error: Process completed with exit code 1.
@v1a0 v1a0 added bug Something isn't working or doesn't seems to work right help wanted Extra attention is needed labels Jun 19, 2021
@kingabzpro
Copy link
Contributor

I have same error
image

@v1a0
Copy link
Owner Author

v1a0 commented Jun 25, 2021

SQLite supports a limited subset of ALTER TABLE. The ALTER TABLE command in SQLite allows the user to rename a table or to add a new column to an existing table. It is not possible to rename a column, remove a column, or add or remove constraints from a table.

https://stackoverflow.com/questions/8442147/how-to-delete-or-add-column-in-sqlite

https://www.sqlite.org/faq.html#q11

https://www.sqlite.org/lang_altertable.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working or doesn't seems to work right help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants