Skip to main content

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

csvsql -h

    usage: csvsql [-h] user password host database table filename

    positional arguments:
        user         user for database login
        password     password for login if necessary
        host         host IP for database
        database     database to run queries on
        table        table to insert into (will create new if doesn't exist)
        filename     filepath of CSV file to insert

    optional arguments:
        -h, --help   show this help message and exit
        --overwrite  Overwrite already-present table in database

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.Session import Session

sess = Session('username','password', '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

MPL-2.0

Release files for cssaw-central 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cssaw-central 1.3.0
File Size Uploaded
cssaw_central-1.3.0.tar.gz 5.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cssaw-central 1.3.0
File Interpreter ABI Platform
cssaw_central-1.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 17.6 kB

Release files / cssaw_central-1.3.0.tar.gz

Download URL cssaw_central-1.3.0.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
47cffd00029dd67713d4982a3dbf00fdbd46c837bda260022a137fa35435068a
BLAKE2b-256 checksum
How to use checksums
c50f7c781fa76abf14698d580616cf6bc1aa75d54438271e66abe39f19902138
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

Release files / cssaw_central-1.3.0-py3-none-any.whl

Download URL cssaw_central-1.3.0-py3-none-any.whl
Size 11.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9b9ae7d9f9c4127a3175cc6745a599faceef9b6034546be9bcae0d8558f98820
BLAKE2b-256 checksum
How to use checksums
fec8d39d75260e53a0c8e88430b46bdf1708683723f6fd546473e61525ea8563
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

Release history Release notifications | RSS feed

This release

1.3.0 This release

2 release files

1.2.9

1 release file

1.2.8

1 release file

1.2.7

2 release files

1.2.6

2 release files

1.2.5

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page