22 lines
619 B
Python
22 lines
619 B
Python
|
|
import os
|
||
|
|
import asyncio
|
||
|
|
from src.core.database import get_database
|
||
|
|
from sqlalchemy import text
|
||
|
|
|
||
|
|
async def check_db():
|
||
|
|
try:
|
||
|
|
db = get_database()
|
||
|
|
session = db.get_session()
|
||
|
|
async with session:
|
||
|
|
result = await session.execute(text("SELECT id, symbol, side, order_type, quantity, status, created_at FROM orders ORDER BY id DESC LIMIT 20;"))
|
||
|
|
rows = result.fetchall()
|
||
|
|
for row in rows:
|
||
|
|
print(row)
|
||
|
|
except Exception as e:
|
||
|
|
print(f"Error: {e}")
|
||
|
|
finally:
|
||
|
|
await db.close()
|
||
|
|
|
||
|
|
if __name__ == "__main__":
|
||
|
|
asyncio.run(check_db())
|