Skip to main content

Pony Database Facade

Latest Version Apache 2.0 STARS

PonyORM Database object Facade. The package encapsulates the names of the parameters used in the low-level modules.

Русская документация

Installation

pip install pony-database-facade

Constructor

The DatabaseFacade constructor and the bind method takes the following arguments:

provider

The name of the database provider. One of the list: sqlite, mysql, postgres or oracle. By default is sqlite.

dbname

The name of the database. If you are using SQLite, the name of the file in which SQLite will store the data and by default is :memory:.

host

Name of host to connect to. By default is localhost.

port

TCP port of database server. By default is standard port.

user

User to authenticate as. By default is None.

password

Password to authenticate with. By default is None.

charset (MySQL only)

By default is utf8.

create_db (SQLite only)

Try to create the database if such filename doesn’t exists. By default is True.

*args

parameters required by the database driver.

**kwargs

parameters required by the database driver.

# SQLite in memory
db = DatabaseFacade()

# MySQL, localhost, no user, no password, used database blog
db = DatabaseFacade('mysql', dbname='blog')
db = DatabaseFacade(provider='mysql', dbname='blog')

# PostgreSQL
db = DatabaseFacade()
db.bind('postgres',
        host='my.vps.com',
        user='anyone',
        password='anykey',
        dbname='blog')

Connection

To connect to the database, use the connect method. This method takes the same arguments as generate_mapping, but the default for create_tables is True. This method also calls the bind method.

db = DatabaseFacade()
db.connect()

Full example

from pony.orm import Required, db_session, show
from pony_database_facade import DatabaseFacade


db = DatabaseFacade()


class Person(db.Entity):
    username = Required(str, 50)


db.connect()

with db_session:
    person_1 = Person(username='Linus')

show(person_1)

Metadata

Release files for pony-database-facade 2.0.1

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

Source distribution (sdist)

Source distribution for pony-database-facade 2.0.1
File Size Uploaded Provenance
pony-database-facade-2.0.1.tar.gz 4.4 kB Without provenance Details

Release files / pony-database-facade-2.0.1.tar.gz

Download URL pony-database-facade-2.0.1.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9845afdaa7f2e5c01e5de92a5906f497335bac5e2d5e38e0a0015de271ca4b88
BLAKE2b-256 checksum
How to use checksums
7e4b56e48e4809483da3ea144a95f9e1b470a44b47d55f1f9314cc3fb5114f15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for pony-database-facade 2.0.1

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.

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