A python API for managing postgresql database
Install and setup
Install third party packages:
sudo apt install python3-dev libpq-dev unixodbc-dev
To install the package
python3 -m pip install acrocord
use python in the proper environment e.g. in conda powershell
Setup database configuration and connection
SSL connection: if SSL connection is required, put the certificates given by administrator in /home/$USER/.postgresql create the folder if it does not already exist
Default connection configuration can be saved in connections.cfg in the folder /home/$USER/.postgresql/ for linux
user or typically C:\Users\$USER\.postgresql for windows user.
Example of connections.cfg:
[connection-name]
user=USERNAME
dbname=DATABASENAME
port=PORT
host=HOST
ssh=False
password=PASSWORD
Then in python the connection can directly be instantiate using the keyword connection-name
from acrocord import ConnectDatabase
db = ConnectDatabase()
db.connect(connection="connection-name")
Alternatively, you can use the following syntax
from acrocord import ConnectDatabase
db = ConnectDatabase()
connection = dict(
user="USERNAME",
print_sql_cmd=True,
dbname="DATABASENAME",
port="PORT",
host="HOST",
ssh=False
)
db.connect(print_sql_cmd=True, connection=connection)
Simple usage
import pandas as pd
# create schema (i.e. an independent database: requires privileges)
# write table in schema
# read table as pandas dataframe
db.create_schema("SCHEMA")
db.write_table(pd.DataFrame(1, index=[1, 2, 3], columns=[1, 2, 3]), "SCHEMA.NAME")
db.read_table("SCHEMA.NAME")
Other topics
- Deploy database: install postresgql server and create database on premise
- Manage spatial data using postgis: how to install postgis and manipulate spatial data
Author
- Eurobios Mews labs
Metadata
Release files for acrocord 2023.3.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| acrocord-2023.3.4.tar.gz | 34.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| acrocord-2023.3.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 72.1 kB
Release files / acrocord-2023.3.4.tar.gz
| Download URL | acrocord-2023.3.4.tar.gz |
|---|---|
| Size | 34.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
663e6b5833d31f9b9bc480dcc680537960eb494d9519da2327ff5461a3d6a943
|
|
BLAKE2b-256 checksum How to use checksums |
a9d0b17123b882a9e4239caa03eec4bbc06847e19bb8974b497d20051d67cd99
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / acrocord-2023.3.4-py3-none-any.whl
| Download URL | acrocord-2023.3.4-py3-none-any.whl |
|---|---|
| Size | 37.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
03ef729bf3564753a8270ce08d3f23cad552a4e38ca0e07e1b6cad4ba8db0748
|
|
BLAKE2b-256 checksum How to use checksums |
1634339ecdf498007acc9a07d1a8bfb91258c5b34697d6531769ed6d5103f382
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|