Package for Postgres query on python
Project description
Postgres Helper
The postgres-helper
library is build on top of psycopg2
. It will be really helpful for running the basic postgresql query in python.
Checkout the official documentation of this library here: postgres-helper.readthedocs.io/
Installation
For installation of postgres-helper
, you need to run following command
pip install postgres-helper
Examples using this library
Please check the official documentation here: https://postgres-helper.readthedocs.io/.
#Library import
from pg.pg import Pg
# Initialization of library
pg = Db(dbname='postgres', user='postgres', password='admin', host='localhost', port='5432')
# Get the column names of the specific table
pg.get_columns_name(table='pg_table')
# Get values from specific column of table
pg.get_values_from_column(column='pg_table_col', table='pg_table', schema='public')
# Create schema
pg.create_schema(name='schema_name')
# Create column
pg.create_column(column='col_name', table='pg_table', col_datatype='varchar', schema='public')
# Update column
pg.update_column(column='col_name', value='updated_value', table='pg_table', where_column='where_col', where_value="where_val", schema='public')
# Delete table
pg.delete_table(name='pg_table', schema='public')
# Delete values
pg.delete_values(table_name='pg_table', condition='name=value', schema='public')
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
postgres-helper-0.0.5.tar.gz
(4.4 kB
view hashes)
Built Distribution
Close
Hashes for postgres_helper-0.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d7cf33b076f3a7544846f5d2f6219585294f6c39be77895941d7d2bc9ecfe1a |
|
MD5 | c88ef4be5b0684a6ef8ebdf4247e92ab |
|
BLAKE2b-256 | ce2abc6bb455fc4ccb89f491110c2819d1e28b90448e68baa95e9e9be6f44242 |