Code Monkey home page Code Monkey logo

faker-sqlalchemy's Introduction

Fakers for SQLAlchemy

PyPI Build Supported Python versions Documentation Downloads

SQLAlchemy Faker is a provider for the Faker library that helps populate SQLAlchemy ORM models with dummy data. Creating a new instance of a model can be as simple as calling fake.sqlalchemy_model(SomeModel).

Installation

The recommend way to install SQLAlchemy Faker is with pip:

pip install faker_sqlalchemy

Example

Say you have some model declared using SQLAlchemy's ORM.

>>> class SomeModel(Base):
...     __tablename__ = "some_model"
...
...     id = Column(Integer, primary_key=True)
...
...     value = Column(String)

And, you want to easily generate some data,

>>> from faker_sqlalchemy import SqlAlchemyProvider
>>>
>>> fake = Faker()
>>> fake.add_provider(SqlAlchemyProvider)
>>>
>>> instance = fake.sqlalchemy_model(SomeModel)

Use instance as desired.

>>> print(instance.value)
RNvnAvOpyEVAoNGnVZQU

Supported Versions

Currently SQLAlchemy versions 1.3 and 1.4 are supported. Support for SQLAlchemy 2.0 will be added when it is released.

Faker versions >=8 are currently supported, though it should be noted that the testing matrix isn't exhaustive. If bugs come up with a particular version of faker beyond version 8.0, submit a ticket to add support.

Python versions >=3.7 are currently supported. If python 3.6 support is desired, submit a ticket to add support. Support for Python 3.11 will be added when it is officially supported by SQLAlchemy. Currently, this is waiting on greenlet releasing support for python 3.11.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.