Wrappers for PostgreSQL interaction using dataframes or dictionaries.
Project description
cheesefactory-database
A wrapper for psycopg2.
Main Features
- Built on psycopg2.
- Pandas dataframe support.
- Test table existence.
- Test field existence.
Note: This package is still in beta status. As such, future versions may not be backwards compatible and features may change.
Installation
The source is hosted at https://bitbucket.org/hellsgrannies/cheesefactory-database
pip install pandas
Dependencies
License
Parameters
class CfPostgres(host: str = 127.0.0.1, port: int = 5432, user: str = None, password: str = None, database: str = None)
Handles the connection to a PostgreSQL database.
- host: PostgreSQL server hostname/IP.
- port: PostgreSQL server port.
- user: Username for authentication.
- password: Password for authentication.
- database: Database for connection
Examples
Connect to the remote SFTP server
from cheesefactory-database.postgresql import CfPostgres
# Establish connection
db = CfPostgres(host='myhostname', user='myusername', password='mypassword', database='mydatabase')
# Execute query
results = db.execute("SELECT first_name, last_name FROM person WHERE last_name = 'Smith'")
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
Close
Hashes for cheesefactory-database-0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1b0ae5ca12b92d4cc7dd4e7f016b10edfd63d0572be15fbc4edc352a306d417 |
|
MD5 | afc7284942bb7dfee090887b5fbc3831 |
|
BLAKE2b-256 | 3c7130eb04012088b42bf60da882c4744ad3bd81315e0a6139e1fae791870d7a |