Skip to content

create table does not create unique keys and indexes #580

Open
@YuriFontella

Description

@YuriFontella

By defining the index on the columns and as a unique key, the table is created with the CreateTable function, but the keys are not.

users = Table(
    'users',
    metadata,
    Column('id', Integer, primary_key=True),
    Column('name', String(length=255)),
    Column('email', String(length=255), unique=True, index=True)
)
for table in metadata.tables.values():
    schema = sqlalchemy.schema.CreateTable(table, if_not_exists=True)
    query = schema.compile(dialect=postgresql.dialect())

    await database.execute(query=str(query))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions