Skip to main content

Parse database connection strings

Project description

cxnstr

Parse database connection strings in python. Currently only supports MySQL.

>>> import cxnstr
>>> params = cxnstr.to_dict("myhost:3306/MyDB?read_default_file=~/.my.cnf")
>>> params
{'host': 'myhost', 'port': 3306, 'db': 'MyDB', 'read_default_file': '~/.my.cnf'}
>>> import pymysql
>>> conn = pymysql.connect(**params)

See doctests for full connection string specification.

The library also includes a command line program for parsing connection strings and outputting in various formats:

$ cxnstr -t json "myhost:3306/MyDB?read_default_file=~/.my.cnf"
{"read_default_file": "~/.my.cnf", "db": "MyDB", "host": "myhost", "port": 3306}

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

cxnstr-1.1.5.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cxnstr-1.1.5-py2-none-any.whl (4.8 kB view details)

Uploaded Python 2

File details

Details for the file cxnstr-1.1.5.tar.gz.

File metadata

  • Download URL: cxnstr-1.1.5.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.8.3 requests/2.27.1 setuptools/44.1.1 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/2.7.18

File hashes

Hashes for cxnstr-1.1.5.tar.gz
Algorithm Hash digest
SHA256 39dd4bd2e18254662ff331751999430c8e490d2df2bc4f83319eae14af5a507f
MD5 bc89e20cb0f69cb8f5459cc1d8cbb842
BLAKE2b-256 c91f1d975507db8d4f832f096b4589f5ff1b6ac82b4c7880e3bf952f415976fb

See more details on using hashes here.

File details

Details for the file cxnstr-1.1.5-py2-none-any.whl.

File metadata

  • Download URL: cxnstr-1.1.5-py2-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.8.3 requests/2.27.1 setuptools/44.1.1 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/2.7.18

File hashes

Hashes for cxnstr-1.1.5-py2-none-any.whl
Algorithm Hash digest
SHA256 cb39118982e93a17c891d4bd7ed858bd065c8ecd145cddb2075ef496ccddba14
MD5 8957a81bc880af439c4085b8e783a3fa
BLAKE2b-256 8819ba58b0fa9341521f1e0dc8b83eeeaf6e02a549d20a680853c9ec8917d03a

See more details on using hashes here.

Supported by

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