-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.py
33 lines (27 loc) · 899 Bytes
/
models.py
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
from sqlalchemy import MetaData,Integer,String,Table,Column,ForeignKey
metadata = MetaData()
author = Table(
"author",
metadata,
Column("id",Integer,primary_key=True, autoincrement=True),
Column("name",String,nullable=False),
Column("lastname",String,nullable=False),
Column("surname",String,nullable=False),
)
publisher = Table(
"publisher",
metadata,
Column("id",Integer,primary_key=True, autoincrement=True),
Column("publisher",String,nullable=False),
Column("city",String,nullable=False),
)
books = Table(
"book",
metadata,
Column("id",Integer,primary_key=True, autoincrement=True),
Column("title", String,nullable=False),
Column("kind",String,nullable=False),
Column("year",Integer,nullable=False),
Column("id_author",Integer,ForeignKey("author.id")),
Column("id_publisher",Integer,ForeignKey("publisher.id")),
)