#๐Ÿ”’ No support for ALTER of constraints in SQLite dialect. Please refer to the batch mode feature whic

8 messages ยท Page 1 of 1 (latest)

stable houndBOT
#

@shrewd halo

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

shrewd halo
#
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_unique_constraint(None, 'contract_new', ['leaser_id'])
    op.create_unique_constraint(None, 'contract_new', ['taker_id'])
    op.add_column('feedback', sa.Column('timestamp', sa.DateTime(), nullable=True))
    op.alter_column('feedback', 'author',
               existing_type=sa.INTEGER(),
               nullable=True)
    op.alter_column('feedback', 'user_feedback',
               existing_type=sa.INTEGER(),
               nullable=True)
    op.alter_column('feedback', 'text_feedback',
               existing_type=sa.TEXT(),
               type_=sa.String(length=500),
               nullable=True)
    op.alter_column('feedback', 'grade',
               existing_type=sa.INTEGER(),
               nullable=True)
    op.alter_column('feedback', 'contract_feedback',
               existing_type=sa.INTEGER(),
               nullable=True)
    op.alter_column('item', 'photo',
               existing_type=sa.TEXT(),
               type_=sa.String(length=150),
               nullable=True)
    op.alter_column('item', 'name',
               existing_type=sa.TEXT(),
               type_=sa.String(length=50),
               nullable=True)
    op.alter_column('item', 'description',
               existing_type=sa.TEXT(),
               type_=sa.String(length=250),
               nullable=True)
    op.create_unique_constraint(None, 'item', ['name'])
    op.alter_column('user', 'login',
               existing_type=sa.TEXT(),
               type_=sa.String(length=50),
               nullable=True)

    op.alter_column('user', 'password',
...
    
#

I initially had this error

sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) near "ALTER": syntax error
[SQL: ALTER TABLE contract ALTER COLUMN text_contract DROP NOT NULL]

#

I tried through
batch_op.alter_column
wrote that the column does not exist in the table

#

KeyError: Column('author', INTEGER(), table=None)

#

!close

stable houndBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.