def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) database.create_tables(( Poll, Password, Candidate, Vote, ))
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) database.create_tables((Currency, Balance, LotoDraw, LotoGrid)) Currency.get_or_create(symbol=DISCORD_MONEY_SYMBOL, name=DISCORD_MONEY_NAME) LotoDraw.get_or_create(defaults=dict(value=DISCORD_LOTO_START)) self.currencies = {} self.balances = {} self.messages = {} self.seeds = [] self._pay_wage.start() self._rate_money.start() self._draw_loto.start()
from base import database from user import User from state import State from city import City from place import Place from place_book import PlaceBook from amenity import Amenity from place_amenity import PlaceAmenities from review import Review from review_user import ReviewUser from review_place import ReviewPlace # connect to database specified in base database.connect() # populate databases with tables database.create_tables([User, State, City, Place, PlaceBook, Amenity, PlaceAmenities, Review, ReviewUser, ReviewPlace], safe=True)
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) database.create_tables((Birthday, )) self._check_birthday.start()
from app.xcat_api import app from base.database import create_tables if __name__ == '__main__': create_tables() app.run(host="0.0.0.0")
# This script creates all tables from each model defined before: User, State, City, Place, PlaceBook, Amenity, PlaceAmenities from base import database from user import User from state import State from city import City from place import Place from place_book import PlaceBook from amenity import Amenity from place_amenity import PlaceAmenities database.connect() database.create_tables([User, State, City, Place, PlaceBook, Amenity, PlaceAmenities], safe=True) test_record=User(email='foo', password='******', first_name='foo',last_name='bar') test_record.save()