This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app.py | |
import asyncio | |
from db import setup_database | |
from models import Employee | |
async def main(): | |
# setup db | |
await setup_database() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app.py | |
import asyncio | |
from db import setup_database | |
from models import Employee | |
async def main(): | |
# setup db | |
await setup_database() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app.py | |
import asyncio | |
from db import setup_database | |
from models import Employee | |
async def main(): | |
# setup db | |
await setup_database() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app.py | |
import asyncio | |
from db import setup_database | |
from models import Employee | |
async def main(): | |
# setup db | |
await setup_database() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app.py | |
import asyncio | |
from db import setup_database | |
from models import Employee | |
async def main(): | |
# setup db | |
await setup_database() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app.py | |
import asyncio | |
from db import setup_database | |
from models import Employee | |
async def main(): | |
# setup db | |
await setup_database() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# db.py | |
from pydbantic import Database | |
from models import Employee | |
async def setup_database(): | |
await Database.create( | |
'sqlite:///company.db', | |
tables=[Employee] | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app.py | |
from models import Employee | |
employee = Employee( | |
salary=20000.0, | |
is_employed=True | |
) | |
print(employee) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# models.py | |
import uuid | |
from datetime import datetime | |
from typing import Optional | |
from pydbantic import DataBaseModel, PrimaryKey, Default | |
def time_now_str(): | |
return datetime.now().isoformat() | |
def stringify_uuid(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat > server_sqlite.json <<EOF | |
{ | |
"DB_TYPE": "sqlite", | |
"DB_NAME": "auth", | |
"ISSUER": "EasyAuth", | |
"SUBJECT": "EasyAuthAuth", | |
"AUDIENCE": "EasyAuthApis", | |
"KEY_PATH": "/my_key-location", | |
"KEY_NAME": "test_key" | |
} |