Example #1
0
def main():
    doc_key = '1TO5Yzk0-4V_RzRK5Jr9I_pF5knZsEZrNn2HKTXrHgls'
    records = google_sheets.download(google_sheets.get(doc_key, 'companies'))

    with db:
        Company.drop_table()
        Company.create_table()

        for record in records:
            Company.create(**coerce_record(record))
def create_company(id, **kwargs):
    return Company.create(id=id,
                          name=kwargs.get('name', 'Banana'),
                          filename=kwargs.get('filename', 'banana.svg'),
                          is_sponsoring_handbook=kwargs.get('is_sponsoring_handbook', False),
                          link=kwargs.get('link', 'https://banana.example.com'),
                          coupon=kwargs.get('coupon', 'BANANA123'),
                          starts_at=kwargs.get('starts_at', date.today() - timedelta(days=10)),
                          expires_at=kwargs.get('expires_at', date.today() + timedelta(days=100)))