-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New method to check if column is autoincremented #9277
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
Comments
Hi, I'm not sure if excluding only incrementing columns would be sufficient for your use case. |
You may be right, would a |
there is already |
if you want any server default col you need to look at server_default also |
though for now, the only API that's not public is the "which col is autoincrement" , so we can make that public. I do think it should be for Table though because it's the Table that chooses this, not the column |
But, that returns
Yes, already thought about looking at default/server_default/nullable to decide whether a field is required or not. |
well yes, an autoincrement or itentity column is not a computed one (as identified by "generated always as") |
Federico Caselli has proposed a fix for this issue in the main branch: Add |
Describe the use case
A method to tell if a column is autoincremented or not.
Preference would be to have something like
Column.is_autoincremented: bool
, but aTable.get_autoincrement_column() -> Column
(as suggested by @zzzeek) would work fine too.Example Use
Or, with an actual implementation:
https://github.com/aio-libs/aiohttp_admin/blob/master/aiohttp_admin/backends/sqlalchemy.py#L43
Additional context
#9261
The text was updated successfully, but these errors were encountered: