25 lines
No EOL
656 B
Python
25 lines
No EOL
656 B
Python
from sqlalchemy.orm import Session
|
|
from sqlalchemy import create_engine
|
|
from sqlalchemy_sandbox.training_core import User
|
|
# Create engine for connecting to postgres test db
|
|
engine = create_engine(
|
|
'postgresql+psycopg2://postgres:pgpwd4habr@localhost:5432/postgres')
|
|
|
|
engine.connect()
|
|
|
|
|
|
with Session(engine) as session:
|
|
toxa = User(
|
|
username="pro100ton",
|
|
first_name="Anton",
|
|
last_name="Shalimov",
|
|
is_coach = False
|
|
)
|
|
pan_stepan = User(
|
|
username="Panstepan",
|
|
first_name="Pan",
|
|
last_name="Stepan",
|
|
is_coach = True
|
|
)
|
|
session.add_all([toxa, pan_stepan])
|
|
session.commit() |