-
Notifications
You must be signed in to change notification settings - Fork 248
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
Error when reading vector column of pgvector #340
Comments
|
Did you install the project with the |
@agronholm
|
Others have successfully tested the pgvector integration. Any idea why it's not working for you? |
I downgraded pgvector to 0.2.5 and it worked fine, was having the same issue before! |
Pinpointing the specific commit where it starts to fail would probably help. |
Things to check first
I have searched the existing issues and didn't find my bug already reported there
I have checked that my bug is still present in the latest release
Sqlacodegen version
3.0.0rc5
SQLAlchemy version
2.0.31
RDBMS vendor
PostgreSQL
What happened?
Issue:
When attempting to add a new column to the
recommend_model."Image"
table using the following SQL command:then, we encountered an issue where the
pgvector.sqlalchemy.vector.VECTOR
type is not being properly recognized in the context of theget_adapted_type
method. This results in the column type falling back tosqlalchemy.sql.type_api.UserDefinedType
instead.Analysis
The VECTOR type is recognized, but since it is an uppercase type, the loop continues to check for any camel case types. As a result, UserDefinedType is found, but since it does not have the get_col_spec method, an error occurs.
Potential Fixes
Avoid to use UserDefinedType when get adapted type:
UserDefinedTypeが発見された場合、すでにnew_coltypeがあった場合はそちらを優先する方針がよさそう。
It seems a good approach to prioritize an existing detected new_coltype if UserDefinedType is found.
It seem to be below:
Add Special Handling for
VECTOR
:Include a specific check for the
VECTOR
type:VECTORの時点で現状、キャメルケースがくることはない。→しかし、今後来るようになる可能性はある?
Currently, there are no camel case types coming after VECTOR. However, it is possible that they might come in the future.
Remove the Uppercase Check:
Replace the existing check with a break statement, allowing
VECTOR
to be recognized:→ Due to the impact on other areas, this approach is rejected.
Output on success
References
Commit where if supercls.name != supercls.name.upper() was introduced
ralated issue
#300
What is the difference between
Text
andTEXT
types in SQLAlchemy?ref. https://docs.sqlalchemy.org/en/20/core/type_basics.html#generic-camelcase-types
Removing
if supercls.__name__ != supercls.__name__.upper(): break
results in differences, such as parts previously outputting asText
now appearing asTEXT
.Database schema for reproducing the bug
(WIP)
The text was updated successfully, but these errors were encountered: