Skip to main content

A way to run queries and execute commands against an MSSQL database.

Project description

# mssql_cli
A way to run queries and execute commands against an MSSQL database.


## Code Example
```python
import datetime # used for an example below
from mssql_cli import DBRead, DBWrite

read_connection = DBRead(host='some_host', user='some_user', password='some_password', database='some_database')
write_connection = DBWrite(host='some_host', user='some_user', password='some_password', database='some_database')

results = read_connection.query("SELECT * FROM some_table")
more_results = write_connection.query("SELECT * FROM some_table")

write_connection.execute("INSERT INTO [some_table] ([name], [phone_number], [time]) VALUES ('Prince', '111-111-1111', '1999-12-31 23:59:59')")

# insert_results() will create an insert statement based off of a table name and kwargs and execute the resulting statement.
write_connection.insert_results(table='some_table', name='Prince', phone_number='111-111-1111', time=datetime.datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S'))

read_connection.close()
write_connection.close()
```

## Motivation
This library exists to run queries and execute commands against an MSSQL database.

## Installation
This package requires pymssql, which has a dependency on FreeTDS. Instructions on installing FreeTDS can be found here: http://pymssql.org/en/latest/freetds.html.

pip install mssql_cli

## License
MIT

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

mssql_cli-0.3.tar.gz (3.8 kB view details)

Uploaded Source

File details

Details for the file mssql_cli-0.3.tar.gz.

File metadata

  • Download URL: mssql_cli-0.3.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for mssql_cli-0.3.tar.gz
Algorithm Hash digest
SHA256 0f5596e3a5d21517ac383400527bf2d0621120e3fa3948a1a08c69a2f639b54a
MD5 e7870fe1ad316943e74a1e85a7e2fc14
BLAKE2b-256 b307c9ec8efa242e966b066a31b7eeed5f073ccb996a0be0938835b472fec128

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