SQython
A wrapper for SQL and python.
requirments
- psycopg2
- os
- numpy
- io / StringIO
- pandas
This was made to create an easier access to SQL through python
instalation
pip install sqython
example use cases
# creating a connection to my DB and creating a new database
conn = sq.create_connection("postgres", "postgres", "3301", 'localhost', 5432)
sq.execute_query(conn,create_database('maxtest'))
# after creating we need to connect to our new database
conn = sq.create_connection("maxtest", "postgres", "3301", 'localhost', 5432)
# creating a table based on column names and datatypes to each of their respective columns
sq.execute_query(conn,make_table('testtable',['test1','test2','test3'],['serial','char(50)','char(50)'],'test1'))
# sample DataFrame that we will insert
data = {'test1':[1,2,3],
'test2':['max','luke','aids'],
'test3':['a','B','c']}
data = pd.DataFrame(data)
# pushing the data to DB
sq.execute_many(conn,data,'testtable')
# example of deleting new table
sq.execute_query(conn,delete_table('testtable'))
# if we want to delete the current database we must connect to a different one before deletion
conn = sq.create_connection("postgres", "postgres", "3301", 'localhost', 5432)
sq.execute_query(conn,sq.delete_database('maxtest'))
# example of altering a column name
sq.execute_query(conn,sq.alter_column_name(testtable,'test2','names'))
# example of changing an existing columns datatype
# changing column 'names' to varchar
sq.execute_query(conn,sq.alter_datatype(testtable,'names','VARCHAR'))
# to write your own query!
query = 'select * from table'
sq.execute_query(conn,query)
# Currently working on a more efficient and easy querying method
Metadata
Release files for SQython 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| SQython-0.0.2.tar.gz | 2.1 kB | Without provenance | Details for SQython-0.0.2.tar.gz |
Release files / SQython-0.0.2.tar.gz
| Download URL | SQython-0.0.2.tar.gz |
|---|---|
| Size | 2.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0dee505db6026ac7d8629f73ecd5095a6eb84b96b920a477bd7907523d16d71b
|
|
BLAKE2b-256 checksum How to use checksums |
5a8fdfd2fb14e1a8459ad11c355b5dffd6a1c4b833f7515e9a85c517b637cc46
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.9
|
Security for SQython 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.