-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdb_setup.py
More file actions
43 lines (33 loc) · 1.55 KB
/
db_setup.py
File metadata and controls
43 lines (33 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from sqlalchemy import Column, ForeignKey, Integer, String, create_engine
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class Replacements(Base):
__tablename__ = 'replacements'
# Here we define columns for the table person
# Notice that each column is also a normal Python instance attribute.
id = Column(Integer, primary_key=True)
substitution_group = Column(String(250), nullable=False)
substitution_scope = Column(String(250), nullable=False)
from_word = Column(String(250), nullable=False)
to_word = Column(String(250), nullable=False)
class ReceitasTerceirizadas(Base):
__tablename__ = 'receitas_terceirizadas'
# Here we define columns for the table person
# Notice that each column is also a normal Python instance attribute.
id = Column(Integer, primary_key=True)
tipo_gestao = Column(String(250), nullable=False)
tipo_escola = Column(String(250), nullable=False)
edital = Column(String(250), nullable=False)
diasemana = Column(String(250), nullable=False)
idade = Column(String(250), nullable=False)
refeicao = Column(String(250), nullable=False)
cardapio = Column(String(1000), nullable=False)
# Create an engine that stores data in the local directory'scardapio
# sqlalchemy_example.db file.
def set():
engine = create_engine('sqlite:///configuracoes_editor_merenda.db')
# Create all tables in the engine. This is equivalent to "Create Table"
# statements in raw SQL.
Base.metadata.create_all(engine)
if __name__ == '__main__':
set()