Access Point Module to CSSAW Database
Project description
CSSAW_Central
Installation
pip install cssaw-central
Usage
csvsql script
The package comes with a script to automatically upload a csv file to the given table in a sql database. It takes user, pass, host IP, database, table, and cSV file path as arguments
example
csvsql test test HOST Test test_table ./TestDocs/test.csv
The above example connects to the Test database using the test user and inserts the test.csv file into test_table.
Session module
Session object acts as a wrapper for sqlalchemy connection. The connection is created and stored in the Session object at initialization, and any results can be taken from the self.conn object or, if using execute_sql(), can be taken from the returned results python list.
Example:
from cssaw_central import Session
sess = Session('test','test', 'localhost', db='Test')
sess.create_table('test_table', ['column1', 'column2', 'column3'], \
[int, int, int])
sess.insert('test_table', ['column1', 'column2', 'column3'], [0, 1, 2])
print(sess.execute_SQL('./queries/test.sql'))
The above script will create a connection to the Test database at localhost:3306 (assuming that it exists), insert the given values into their appropriate columns in test_table, and then execute test.sql from the queries file.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for cssaw_central-1.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03cd4d1d96efecb1b200596e104d28b71afdf0f53bc1ffabc5210ebd028ee1d0 |
|
MD5 | 7501d98cd461e97f92066ed9b5456764 |
|
BLAKE2b-256 | 4c1c3a96745b513911b186ad43149f8796f97929f89dbd9e65d33d8ab39f2e2c |