Skip to content

More usable handling of connection string for mssql-python #306

@saurabh500

Description

@saurabh500

Is your feature request related to a problem? Please describe.

Today mssql-python passes the connection string to the underlying implementation i.e. the ODBC driver for SQL server.

While doing so, the driver exposes the problems with connection string with ODBC.

  1. Permissive connection string handling. Unsupported / bad keywords like Thisdoesntexist=FooBar, is accepted and ignored. The problem is that using a connection string parameter which is not supported by ODBC and not seeing it being effective is hard to debug.
  2. First instance wins: For long complex connection strings, if the keys are repeated then the first occurrence of the key and its value are honored. e.g. uid=test1;TrustServerCertificate=yes;uid=test2, then uid=test1 is honored.
  3. Special keywords like Driver / App are a no-op with mssql-python. App is always overridden.

Describe the solution you'd like

  1. Error out on duplicate keys.
  2. Error out if the keys are not supported.
  3. Disallow setting of reserved connection string keywords like Driver / App if they are going to be overridden.
  4. Allow ODBC style escaping using { }.
  5. Don't error out on the first violation, e.g. if a connection string has repeated keys and unsupported keys, then don't error out with a duplicate key error, fixing which would lead to unsupported keys error. If possible, provide a list of all the errors in one go.
  6. The parameters which haven't been tested with the python experience, should not be allowed and allow-listed when mssql-python is ready to surface the experience.

The proposal is generally to move to a more usable handling of connection string and overall mssql-python drivers' experience.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions