sqlacodegen
sqlacodegen copied to clipboard
MSSQL - Connection string parameters causing error
Hi,
When using MSSQL and passing parameters through its connections string (for example TrustServerCertificate, driver, etc), the package responds saying that the parameter that comes after the "&" is not recognized as a command.
I have made an workaround on my local version to fix this, but maybe there's a better way to take care of it. Below are the changes:
Current cli.py file on lines from 38 to 40
# Use reflection to fill in the metadata
engine = create_engine(args.url)
Changes on those lines:
conn_str = args.url
if 'mssql' in conn_str:
conn_str = conn_str + '&TrustServerCertificate=yes'
# Use reflection to fill in the metadata
engine = create_engine(conn_str)
What did you try on the command line? Did you quote the parameters correctly?