cssaw-central-1.3.0
توضیحات
Access Point Module to CSSAW Database
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | cssaw-central-1.3.0 |
| نام | cssaw-central |
| نسخه کتابخانه | 1.3.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Luke Williams |
| ایمیل نویسنده | williams.luke.2001@gmail.com |
| آدرس صفحه اصلی | https://github.com/CSSAW/CSSAW_Central |
| آدرس اینترنتی | https://pypi.org/project/cssaw-central/ |
| مجوز | - |
# CSSAW_Central
## Installation
``` Bash
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
``` Console
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
``` Bash
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:
```Python
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](https://opensource.org/licenses/MPL-2.0)
نیازمندی
| مقدار | نام |
|---|---|
| >=1.19.0 | numpy |
| >=1.0.5 | pandas |
| >=0.9.3 | PyMySQL |
| >=2.8.1 | python-dateutil |
| >=2020.1 | pytz |
| >=1.15.0 | six |
| >=1.3.17 | SQLAlchemy |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.6 | Python |
نحوه نصب
نصب پکیج whl cssaw-central-1.3.0:
pip install cssaw-central-1.3.0.whl
نصب پکیج tar.gz cssaw-central-1.3.0:
pip install cssaw-central-1.3.0.tar.gz