Skip to content
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

Allow generation for tables without a Primary Key (ie: Timescale's Hypertables) #1408

Open
Serjlee opened this issue Aug 8, 2024 · 2 comments

Comments

@Serjlee
Copy link

Serjlee commented Aug 8, 2024

I know this was already labeled as a "won't do" in #75 (comment), but I recently stumbled upon a proper use case when dealing with Timescale's Hypertables: for those, primary keys degrade performance and have little use, as foreign keys pointing to hypertables are not allowed.

Even without PKs sqlboiler would still be very valuable to provide generated types, constants, where helpers and perform queries in a consistent way.

I found a okay-ish workaround by using a View defined as select * from my_table_without_pk, but this causes all columns of the generated type to be nullable, which is quite annoying,

Is it something you might plan to reconsider? I tried to implement it myself but so far I failed to produce anything useful

@stephenafamo
Copy link
Collaborator

Well... now that there is support for views, it should be possible.

The thing would be to read the tables as usual, and then add any table without a primary key to the views.

@Serjlee
Copy link
Author

Serjlee commented Oct 23, 2024

Thanks for considering it, I'll then try again to write a PR as soon as I have time for it

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

No branches or pull requests

2 participants