Skip to main content

Query SQL Browser for port used by named instance

Project description

sqlserverport

A simple Python module to query the SQL Browser service for the port number of a SQL Server instance. The Linux implementation of Microsoft's "ODBC Driver xx for SQL Server" is (still) unable to resolve instance names, so Windows users can just do

import pyodbc
serverspec = r'myserver\SQLEXPRESS'
conn = pyodbc.connect('DRIVER=ODBC Driver 17 for SQL Server;SERVER={};...'.format(serverspec))

but that won't work on Linux. This module lets us do

import pyodbc
from sqlserverport import sqlserverport
servername = 'myserver'
serverspec = '{0},{1}'.format(
    servername,
    sqlserverport.lookup(servername, 'SQLEXPRESS'))
conn = pyodbc.connect('DRIVER=ODBC Driver 17 for SQL Server;SERVER={};...'.format(serverspec))

Installing

pip install sqlserverport

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sqlserverport-1.0.0.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

sqlserverport-1.0.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file sqlserverport-1.0.0.tar.gz.

File metadata

  • Download URL: sqlserverport-1.0.0.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.9

File hashes

Hashes for sqlserverport-1.0.0.tar.gz
Algorithm Hash digest
SHA256 bbcb707b0a51cdd27978c7cbe106027496ddbfb90d17682e41407dbb6e027ca7
MD5 b31961ca40a8de129be0e267d56ee644
BLAKE2b-256 cc08de2bf7c831e333d39be69b85e5a682378aa71313f48070b1da41a1c87daa

See more details on using hashes here.

File details

Details for the file sqlserverport-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: sqlserverport-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.9

File hashes

Hashes for sqlserverport-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 54cd6b6ab5f6c68f2efed19015cbe43de6df7906e5d29ee8a28d9ed4db516e62
MD5 0949022f9414f3de6b6565c03f75e662
BLAKE2b-256 2703ea307eb62ce91fe6a739303c3475157c4a614aba6861d76c4052f43f6115

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page