Skip to main content

No project description provided

Project description

SpawnDB

This is a simple library that helps in the creation of test databases for Python projects that use SQLAlchemy.

It's aim it's to seamlessly handle creation of a separate test database, including the creation of all schemas, their objects and finally, handling the destruction of the test database when it's no longer needed.

Usage

To create a test database, use the init_test_db function.

This function expects two arguments:

  • database_url: sqlalchemy.engine.URL
  • metadata: sqlalchemy.schema.MetaData

It will return an instantiated Engine for the test database which you can use for your database logics.

# Sample usage for Pytest
from spawndb import init_test_db, destroy_test_db

def my_cool_test():
    db_engine = init_test_db(database_url, sqla_metadata)
    
    try:
        # your stuff goes here
    
    finally:
        destroy_test_db(database_url)

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

spawndb-0.1.18.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

spawndb-0.1.18-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file spawndb-0.1.18.tar.gz.

File metadata

  • Download URL: spawndb-0.1.18.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.9.16 Darwin/22.2.0

File hashes

Hashes for spawndb-0.1.18.tar.gz
Algorithm Hash digest
SHA256 9be73c77f72abad82c7a0f56e71a8a1e0dbd1e18abb1837c2a9ece1a25458693
MD5 0be6c545932a4384454cf3091b1bb9e2
BLAKE2b-256 89325072deadcdcd5c139d9214f03f4d7a48e46fbd510c7532b425f85628e97b

See more details on using hashes here.

File details

Details for the file spawndb-0.1.18-py3-none-any.whl.

File metadata

  • Download URL: spawndb-0.1.18-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.9.16 Darwin/22.2.0

File hashes

Hashes for spawndb-0.1.18-py3-none-any.whl
Algorithm Hash digest
SHA256 118aef0be8e6b28bc89b3ffd918894929a52e90dfeb7cabb0b1c6aecefef4af5
MD5 7e52cd397ab578fcf076a2d000be661f
BLAKE2b-256 12bfd1c89df37b9172f4d15ece77c61117dd0b05403c9fdef9c98ad7dc3d9c1c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page