sqlacodegen
sqlacodegen copied to clipboard
sqlalchemy.exc.OperationalError
Things to check first
-
[X] I have searched the existing issues and didn't find my bug already reported there
-
[X] I have checked that my bug is still present in the latest release
Sqlacodegen version
sqlacodegen==3.0.0b2
SQLAlchemy version
SQLAlchemy==1.4.51
RDBMS vendor
MSSQL
What happened?
File "src/pymssql/_pymssql.pyx", line 653, in pymssql._pymssql.connect
sqlalchemy.exc.OperationalError: (pymssql._pymssql.OperationalError) (18456, b"Login failed for user 'sa'.DB-Lib error message 20018, severity 14:\nGeneral SQL Server error: Check messages from the SQL Server\nDB-Lib error message 20002, severity 9:\nAdaptive Server connection failed (localhost)\nDB-Lib error message 20002, severity 9:\nAdaptive Server connection failed (localhost)\n")
(Background on this error at: https://sqlalche.me/e/14/e3q8)
sqlacodegen mssql+pymssql://sql_username:sql_password@server/database
giving above error but with postgres it's working fine.
Database schema for reproducing the bug
No response
What do you expect me to do about this?
What do you expect me to do about this?
I mean, why like this? Am I doing anything wrong?
Well, from the error message if looks like the login failed, so wrong username/password combination. See if you can connect with bare sqlalchemy using the same connection URI.
Well, from the error message if looks like the login failed, so wrong username/password combination. See if you can connect with bare sqlalchemy using the same connection URI.
No, the password and username combination is correct. But didn't check that with sqlalchemy. Will let you know tomorrow. Thanks.
If your password contains certain special characters, they may need to be escaped.