Skip to main content

Dbm

Project with usefull utilities for managing you DB.

Usage

Config

1. Config via dict

Create you config in dictionary:

config = {
    "dms": "mysql",
    "host": "host",
    "port": "port",
    "user": "<your user>",
    "password": "<your password>",
    "database": "<your_db_name>"
}

IMPORTANT : Make sure to use ENV variables for user and password:

Example

user = os.environ.get('MYSQL_PROD_USER')
password = os.environ.get('MYSQL_PROD_PWD')

2. class config

Alternatively - you can create it dirrectly in DBmanagerConfig class.

from dbmanager import DBmanagerConfig

conf = return DBmanagerConfig(
    'mysql',
    '<your database>',
    user,
    password,
    host='host',
    port='port')

DBmanager creation

from dmanager import make_db_manager
from sqlalchemy import MetaData

metadata = MetaData()

dbm = make_db_manager(config, metadata)

metadata - sqlalchemy class for storing all infor about tales. Even if you dont have it yet in your project - you must create it.

DBmanager usage example

import pandas as pd
from sqlalchemy import Integer, MetaData
from sqlalchemy.orm import DeclarativeBase, mapped_column, Mapped

from dbmanager import make_db_manager
from dbmanager.manager import DBmanager

METADATA = MetaData()

def make_dbm(dbms: str) -> DBmanager:
    config['dbms'] = dbms
    return make_db_manager(config, METADATA)

class Base(DeclarativeBase):
    metadata = METADATA


class FooTable(Base):
    __tablename__ = 'foo_bar_table'

    id: Mapped[int] = mapped_column(Integer, primapy_key=True)
    data: Mapped[str]



if __name__ == '__main__':
    dbm = make_dbm('mysql')
    dbm.create_table(FooTable)
    data = pd.read_csv('somecsv.csv')
    dbm.upsert(FooTable, data)

Metadata

Release files for warehouser 0.3.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for warehouser 0.3.9
File Size Uploaded Provenance Actions
warehouser-0.3.9.tar.gz 20.3 kB Without provenance Details for warehouser-0.3.9.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for warehouser 0.3.9
File Interpreter ABI Platform Actions
warehouser-0.3.9-py3-none-any.whl Python 3 none any Details for warehouser-0.3.9-py3-none-any.whl

Total release size: 42.8 kB

Release files / warehouser-0.3.9.tar.gz

Download URL warehouser-0.3.9.tar.gz
Size 20.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b58af5a45bdfd1e93e4c58a03e1a2c5090147b278524d0606b8a2756cf71ea39
BLAKE2b-256 checksum
How to use checksums
b115fabb53de1df668d4987a1c0b1792495d57262407f42b6c970cbed38a4298
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.12

Release files / warehouser-0.3.9-py3-none-any.whl

Download URL warehouser-0.3.9-py3-none-any.whl
Size 22.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8efc8d05d292db6233a7e78a2e03c5f6c9dca50cead517bb79d2e28c742dfe57
BLAKE2b-256 checksum
How to use checksums
4e4a86d67cc87957bc3d7f9e587697448b703c2f3f789c28a516d4d3c8ba1a53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.12

Security for warehouser 0.3.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.9 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page