Skip to content

Using CompositeType breaks multiple database applications #778

@cooperellidge

Description

@cooperellidge

I have an application that manages separate databases, Postgres and SQLite. My Postgres models use CompositeType which causes a before_create DDL event to be registered with a global registered_composite for this column. When SQLAlchemy is creating the SQLite database, it attempts to run this composite but fails as SQLite dialect does not support them.

Fundamentally, this seems to be because SQLALchemy-Utils treats registration as global, not per connection. This seems to be agreed by an ominous TODO...

# TODO: Make the registration work on connection level instead of global level

Git blame shows this hasn't been touched since it was added 10 years ago. I couldn't find a corresponding issue for this TODO.

Can this be fixed? Or, is there a better way to handle Postgres composite types outside of SQLAlchemy-Utils?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions