Skip to content

Problem with Array generic type mapping #383

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

Closed
sheinbergon opened this issue Mar 10, 2025 · 3 comments · Fixed by #385
Closed

Problem with Array generic type mapping #383

sheinbergon opened this issue Mar 10, 2025 · 3 comments · Fixed by #385
Labels
Milestone

Comments

@sheinbergon
Copy link
Collaborator

Hello everyone,

Just found this wonderful library, however I'm facing an issue that I couldn't find an answer for in the docs.

I have a table that uses postgresql ARRAYs, sqlacodegen is perfectly capable of creating the right side of the model, but the types are wrong (partially unknown to be precise).

Anyone know a solution for this? I decided to open a discussion first instead of an issue since others might have already faces this.

CREATE TABLE FOO (
 id SERIAL PRIMARY KEY,
 some_ints INT[],
 some_floats FLOAT[]
);
class Foo(Base)
 #...etc
 # right side is perfect! The type however is partially known
 some_ints: Mapped[Optional[list]] = mapped_column(ARRAY(Integer()))

Saw that this codebase is looking for maintainers, so if PRs are welcome I could take a crack at it.

Originally posted by @JoaquimEsteves in #382

@sheinbergon
Copy link
Collaborator Author

@JoaquimEsteves PRs are more than welcomed

@sheinbergon sheinbergon added this to the 3.1 milestone Mar 10, 2025
@agronholm
Copy link
Owner

Gut feeling is that this should be really easy to fix.

@JoaquimEsteves
Copy link
Contributor

Currently at $WORK, where I'm not allowed to log on to GitHub. I'll try to take a crack at it when I get home :)

Thanks for all your work btw.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants