tortoise / tortoise-orm

Familiar asyncio ORM for python, built with relations in mind
https://tortoise.github.io
Apache License 2.0
4.39k stars 357 forks source link

How can i print sql with register_tortoise() in fastapi? #1553

Open zyk-miao opened 5 months ago

zyk-miao commented 5 months ago

How can i print sql with register_tortoise() in fastapi?

qingshuiyuyu commented 1 month ago

i want know too ~i have to use another script to insert my admin user 这个框架太难用了吧,一堆bug,现在想写测试用例,死活跑不起来,最骚的是官方给的例子跑不起来,真难顶

qingshuiyuyu commented 1 month ago

ok,maybe you can look this page https://github.com/tortoise/tortoise-orm/issues/1576 if use it init admin

fullonic commented 1 month ago

How can i print sql with register_tortoise() in fastapi?

Hey @zyk-miao! What is your final goal? Would you like to know what SQL has been generated? If is that, you can change your logs. See it here https://tortoise.github.io/logging.html?h=log