Skip to content

How to add custom postgres types (e.g. pgvector) in SQLAlchemy + Alembic? #1324

Discussion options

You must be logged in to vote

SQLAlchemy itself will not know how to reflect this type, which is the warning you see. There is an event hook called column_reflect, which would be a great place to allow interception of this "vector" name, however, that event hook will give you a NullType and you won't have the information you need (seems like that might be something that can be improved; we can add a field with the raw type reflect information so that third parties can replace the NullType as needed).

We dont otherwise have a hook for custom types so the way you're placing it into ischema_names right now is the only way to do it.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by MIrinkov
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants