Skip to content

Instantly share code, notes, and snippets.

@codemation
Last active November 15, 2021 09:27
Show Gist options
  • Save codemation/813a3dd21d18586756089b7860f80dc6 to your computer and use it in GitHub Desktop.
Save codemation/813a3dd21d18586756089b7860f80dc6 to your computer and use it in GitHub Desktop.

Revisions

  1. codemation revised this gist Nov 15, 2021. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion pydbantic_app_6.py
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    # app.py
    import asyncio
    from db import setup_database
    from models import Employee
    from models import Employee, Positions

    async def main():

    @@ -14,5 +14,8 @@ async def main():
    )
    all_employees = await Employee.all()
    print(all_employees)

    all_positions = await Positions.all()
    print(all_positions)

    asyncio.run(main())
  2. codemation created this gist Nov 15, 2021.
    18 changes: 18 additions & 0 deletions pydbantic_app_6.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    # app.py
    import asyncio
    from db import setup_database
    from models import Employee

    async def main():

    # setup db
    await setup_database()

    manager = await Employee.create(
    salary=100000.0,
    is_employed=True
    )
    all_employees = await Employee.all()
    print(all_employees)

    asyncio.run(main())