26 lines
885 B
Python
26 lines
885 B
Python
from sqlalchemy import Column, Integer, String
|
|
from sqlalchemy.ext.declarative import declarative_base
|
|
|
|
Base = declarative_base()
|
|
|
|
class Person(Base):
|
|
__tablename__ = "Persons"
|
|
|
|
person_id = Column("PersonID", Integer, primary_key=True, index=True, autoincrement=True)
|
|
last_name = Column("LastName", String(255), nullable=False)
|
|
first_name = Column("FirstName", String(255), nullable=True)
|
|
address = Column("Address", String(255), nullable=True)
|
|
city = Column("City", String(255), nullable=True)
|
|
|
|
"""
|
|
SQL Insert statements:
|
|
INSERT INTO Persons (PersonID, LastName, FirstName, Address, City)
|
|
VALUES
|
|
(1, 'Smith', 'John', '123 Maple St', 'New York'),
|
|
(2, 'Johnson', 'Emily', '456 Oak Ave', 'Los Angeles'),
|
|
(3, 'Williams', 'Michael', '789 Pine Dr', 'Chicago'),
|
|
(4, 'Brown', 'Sarah', '101 Birch Ln', 'Houston'),
|
|
(5, 'Jones', 'David', '202 Cedar Rd', 'Phoenix');
|
|
"""
|
|
|