aneesh-joseph edited a comment on pull request #9973:
URL: https://github.com/apache/airflow/pull/9973#issuecomment-665492863


   > This looks like a better solution than the one with .first()
   
   
   @jarkkorantala yes, but it breaks on My SQL - 
https://github.com/sqlalchemy/sqlalchemy/issues/5481
   
   > it does however deserialize the entire object
   
   I have updated the PR so that it queries for literal(True) instead of 
querying the complete object. 
   
   
   These checks  are now  getting translated into the below queries
   
   MySQL 
   ```
   SELECT 1 AS param_1
   FROM dag_code
   WHERE dag_code.fileloc_hash = 15056821532142474
   LIMIT 1
   ```
   
   MS SQL
   ```
   SELECT TOP 1 1 AS param_1
   FROM dag_code
   WHERE dag_code.fileloc_hash = 15056821532142474
   ```
   
   SQLite
   ```
   SELECT 1 AS param_1
   FROM dag_code
   WHERE dag_code.fileloc_hash = 15056821532142474
   LIMIT 1 OFFSET 0
   ```
   
   Postgres
   ```
   SELECT True AS param_1
   FROM dag_code
   WHERE dag_code.fileloc_hash = 15056821532142474
   LIMIT 1
   ```
   
   Before this PR, they were getting translated into 
   
   MySQL
   ```
   SELECT EXISTS (SELECT *
   FROM dag_code
   WHERE dag_code.fileloc_hash = %s) AS anon_1
   ```
   
   MS SQL(wrong query)
   ```
   SELECT EXISTS (SELECT *
   FROM dag_code
   WHERE dag_code.fileloc_hash = 15056821532142474) AS anon_1
   ```
   
   SQLite
   ```
   SELECT EXISTS (SELECT *
   FROM dag_code
   WHERE dag_code.fileloc_hash = 15056821532142474) AS anon_1
   ```
   
   Postgres
   ```
   SELECT EXISTS (SELECT *
   FROM dag_code
   WHERE dag_code.fileloc_hash = 15056821532142474) AS anon_1
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to