这样的SQL在sqlchemy中怎么写


好吧,看了下文档,没什么头绪,感觉sqlalchemy中的写法我还没掌握到要领
sql是这样的,


 select A.name, B.* from T_A A,T_B B where B.ID = A.MID

sqlalchemy中要怎么写?

sqlalchemy

KAN@on 10 years, 1 month ago

试试下面这个:
sql = """
select A.name, B.* from T_A, T_B where B.ID = A.MID
"""

cursor = db.session.execute(sql)
results = cursor.fetchall()

帕秋莉姆Q answered 10 years, 1 month ago

Your Answer