start creating script
This commit is contained in:
parent
85712548d8
commit
4f2900f1b6
6
main.py
Normal file
6
main.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import asyncio
|
||||||
|
|
||||||
|
from src.script import script
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
asyncio.run(script())
|
@ -1,3 +1,6 @@
|
|||||||
from .engine import async_session_maker as async_session_maker
|
from .engine import async_session_maker as async_session_maker
|
||||||
from .model import Base as Base
|
from .model import (
|
||||||
from .model import Log as Log
|
Base as Base,
|
||||||
|
Log as Log,
|
||||||
|
UserActions as UserActions
|
||||||
|
)
|
@ -0,0 +1,22 @@
|
|||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
from src.database_adapter import async_session_maker, Log, UserActions
|
||||||
|
|
||||||
|
|
||||||
|
def generate_record() -> Log:
|
||||||
|
return Log(
|
||||||
|
user_id=2,
|
||||||
|
date_time=datetime.now(),
|
||||||
|
action=UserActions.FIRST_ENTRY,
|
||||||
|
object_id=None,
|
||||||
|
response=200
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
async def script():
|
||||||
|
async with async_session_maker() as session:
|
||||||
|
record = generate_record()
|
||||||
|
session.add(record)
|
||||||
|
await session.commit()
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user