denisenkom / pytds

Python DBAPI driver for MSSQL using pure Python TDS (Tabular Data Stream) protocol implementation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for Instance Name and Port

opened this issue · comments

TL;DR: can't use pytds because no support for instance name + port ?

Story

Hello Everyone,

at first I want to thank the contributors for providing this package, I think it is a important tool for the python universe.
I really was looking forward to use it for a ETL tool. I was attempting a bulk upsert using stored procedures and table-valued parameters (TVP).

Details

I implemented and tested my solution but was unable to use it with the final system, because i had to connect to an sql server using an instance name along with custom port configuration.

Similar to this example:

tcp:hostname.domain.com\instance,1234

During the call of connect() the following exception was raised due to this line of code:

ValueError: Both instance and port shouldn't be specified

I tried various parameter combinations and looked at the documents but was unable to succeed.

Question

Am I doing something wrong and missing the right parameters of the connect method?
Otherwise if I am doing things correct so far, I would like to know if it would be technically possible to use the table data stream protocol with an instance name and a custom port?
And is there a chance of getting this implemented? I think it would make a lot of sense to support this because it is a common configuration for sql servers.

I am looking forward hearing your opinions.

best regards

Felix

AFAIK instance name is used to determine port. Since you already know the port you can just use it to connect.
So why do you want to provide instance name?

@denisenkom I tried to connect to the database by just using the instance name and it was not working. So I would say that the explicit port is necessary within the connection string when using a instance name along with a static custom port. Or is it possible to use a port without a instance name and still get connected?

Yes, if you have port, you can connect to it without instance name.