Church is a library to generate fake data. It's very useful when you need to bootstrap your database.
➜ ~ pip install church
# At this moment a library has 5 supported locales:
# en_us, de_de, fr_fr, ru_ru and es_es
#
# It's very useful when you need to bootstrap your database.
# Just create a static method that will generate fake data:
class Patient(db.Model):
id = db.Column(db.Integer, primary_key=True)
email = db.Column(db.String(120), unique=True)
phone_number = db.Column(db.String(25))
full_name = db.Column(db.String(100))
gender = db.Column(db.String(64))
nationality = db.Column(db.String(64))
weight = db.Column(db.String(64))
height = db.Column(db.String(64))
blood_type = db.Column(db.String(64))
def __init__(self, **kwargs):
super(Patient, self).__init__(**kwargs)
def __str__(self):
return self.full_name
def __repr__(self):
return '<Patient: {0}>'.format(self.full_name)
@staticmethod
def _churhify(count=2000):
from church import Personal
person = Personal('en_us')
for _ in range(count):
patient = Patient(email=person.email(),
phone_number=person.telephone(),
full_name=person.full_name('f'),
gender=person.gender(),
nationality=person.nationality(),
weight=person.weight(),
height=person.height(),
blood_type=person.blood_type()
)
try:
db.session.add(patient)
except Exception:
db.session.commit()
presturinn - This is a fake API based on Falcon
and Church
.
Church is a pretty simple library. All you need to start is a small guidebook.
Your contributions are always welcome! Please take a look at the contribution guidelines first.
No requirements, no dependencies
«Such teachings come through hypocritical liars, whose consciences have been seared as with a hot iron.» Timothy 1:4