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
don't use typing with ServerDefaultType #180
Conversation
I think you need to update the tests |
i looked, wasnt sure |
oh its this:
yeah, i dunno, that's a weird mistake not very real world. like if server_default does have a type, then sure, but literally pylance is not working with the actual func.now() because I guess we dont have that in the stubs. so i think ill remove that case. |
The server default is any expression that is passed as DDL to the database and these usually don't have SQL types explicitly stated. With the code as is, pylance is complaining about this: Column(DateTime(), server_default=func.now()) and requiring I do this: Column(DateTime(), server_default=func.now(type_=DateTime)) people don't need to do that, server_defaults SQL type always comes from the column type and doesn't normally need to be stated. Also, column_server_default.py was importing "functions as func", which is wrong. "func" is not a module it's a namespace object, fixed that.
b00d386
to
655905a
Compare
yeah that test case was only working because func was pointing to the functions module, which is also not how it's done |
if you like you can publish |
ooh w the button ??? |
Yep |
The server default is any expression that is passed as DDL
to the database and these usually don't have SQL types explicitly
stated.
With the code as is, pylance is complaining about this:
and requiring I do this:
people don't need to do that, server_defaults SQL type always comes
from the column type and doesn't normally need to be stated.
Also, column_server_default.py was importing "functions as func",
which is wrong. "func" is not a module it's a namespace object,
fixed that.