Piccolo Postgres integration for Red
Project description
red-postgres
Piccolo Postgres integration for Red-DiscordBot
File structure for using with cogs
cog-folder/
├── db/
│ ├── migrations/
│ ├── piccolo_conf.py
│ ├── piccolo_app.py
│ ├── tables.py
├── __init__.py
├── cog.py
piccolo_conf.py
import os
from piccolo.conf.apps import AppRegistry
from piccolo.engine.postgres import PostgresEngine
DB = PostgresEngine(
config={
"database": os.environ.get("POSTGRES_DATABASE"),
"user": os.environ.get("POSTGRES_USER"),
"password": os.environ.get("POSTGRES_PASSWORD"),
"host": os.environ.get("POSTGRES_HOST"),
"port": os.environ.get("POSTGRES_PORT"),
}
)
APP_REGISTRY = AppRegistry(apps=["db.piccolo_app"])
piccolo_app.py
import os
from piccolo.conf.apps import AppConfig, table_finder
CURRENT_DIRECTORY = os.path.dirname(os.path.abspath(__file__))
APP_CONFIG = AppConfig(
app_name="cog_name",
table_classes=table_finder(["db.tables"]),
migrations_folder_path=os.path.join(CURRENT_DIRECTORY, "migrations"),
)
for table_classes
add in the list of tables you're using
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
red-postgres-0.0.7.tar.gz
(10.8 kB
view hashes)
Built Distribution
Close
Hashes for red_postgres-0.0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f14acc1b6ab09741b85ec419781b4f27a76d298b0a25e1a16db1a1bd84ac1049 |
|
MD5 | 8f77f211090d8885b3b3f67b39e47c2b |
|
BLAKE2b-256 | 9a9a14255acf2f9dc6783cca3b08240e0a666523ffefacff6a66997469aa5a30 |