Skip to content

fix column ddl bug #40

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

kgpayne
Copy link

@kgpayne kgpayne commented Aug 15, 2025

Column.table can be None, and when that happens it results in:

AttributeError: 'NoneType' object has no attribute '_autoincrement_column'

We use SQLAlchemy to compose dialect-correct DDL statements like:

import sqlalchemy as sa
from sqlalchemy.sql import ddl

create_column_clause = ddl.CreateColumn(
    sa.Column(
       column_name,
        column_type,
    ),
)
compiled = create_column_clause.compile(self._engine).string
return sa.DDL(
    "ALTER TABLE %(table_name)s ADD COLUMN %(create_column_clause)s",
    {
        "table_name": table_name,
        "create_column_clause": compiled,
    },
)

This is why Column.table is None.

Signed-off-by: Ken Payne <5585874+kgpayne@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant