Python module for connect with PostgreSQL
Project description
Connector to database
Connector to database – easy package for connect with database PostgreSQL.
Installation
Install the current version with PyPI:
pip install connectors-to-databases
Or from GitHub:
pip install https://github.com/k0rsakov/connectors_to_databases/archive/refs/heads/main.zip
Example
you can create as many database connectors as you want.
from connectors_to_databases import PostgreSQL
pg = PostgreSQL()
pg_other = PostgreSQL(
host='0.0.0.0',
port=0,
database='main',
login='admin',
password='admin',
)
Creating a table for examples
pg.execute_script('CREATE TABLE simple_ (id int)')
Filling the table with data
# simple pd.DataFrame
df = pd.DataFrame(data={'id':[1]})
pg.into_pg_table(
df=df,
pg_table_name='simple_'
)
Getting data from a table
pg.execute_to_df(
'''select * from simple_'''
)
Getting a connector to the database. It can be used as you need.
pg.get_uri()
What does the connector look like
Engine(postgresql://postgres:***@localhost:5432/postgres)
Delete our simple_
table
pg.execute_script('DROP TABLE simple_')
Contributing
Bug reports and/or pull requests are welcome
License
The module is available as open source under the terms of the Apache License, Version 2.0
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
Close
Hashes for connectors_to_databases-0.0.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7df026a81c31d7f81af53f1afb9afd436b163c0ec5afdc9fb8e31d5ac58a4469 |
|
MD5 | 6440a57519390b90bf080b1a8901f514 |
|
BLAKE2b-256 | 36f0e4e46cb2f558fd553ce114e99ce3d7fc5ccc95466eb739b163bb958acebf |