简体   繁体   中英

How to suppress warnings on cross join select without where clause in sqlalchemy?

When doing something like :

import sqlalchemy as sa

with session() as S:
  print(S.execute(sa.orm.select(A, B)).all())

sqlalchemy display this warning :

<ipython-input-2-fe928e97d8b6>:1: SAWarning: SELECT statement has a cartesian product between FROM element(s) "A" and FROM element "B"

However... A cartesian product (called cross product elsewhere...) is exactly what I am doing and want to do...

So how to suppress this warning ?

可以通过在创建引擎时将enable_from_linting设置为False来抑制警告:

create_engine(connection_url, enable_from_linting=False)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM