mag3141592 opened a new issue, #30081:
URL: https://github.com/apache/airflow/issues/30081

   ### Apache Airflow Provider(s)
   
   common-sql
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Apache Airflow version
   
   2.5.1
   
   ### Operating System
   
   Debian GNU/Linux 11 (bullseye)
   
   ### Deployment
   
   Astronomer
   
   ### Deployment details
   
   _No response_
   
   ### What happened
   
   The `accept_none = True` will only accept the None if you're checking a 
column is equal to 0.
   <img width="595" alt="Screen Shot 2023-03-13 at 3 18 32 PM" 
src="https://user-images.githubusercontent.com/15257610/224845293-ba7c9423-0125-4752-b76c-aea964f3b860.png";>
   
   
   ### What you think should happen instead
   
   Currently this follows the documentation of `accept_none`, but it's not 
entirely intuitive. I think `accept_none` should pass any `None`, rather than 
equate the `None = 0` and then try to check if it passed or failed.
   
   ### How to reproduce
   
   ```from datetime import datetime
   from airflow import DAG
   
   from airflow.providers.snowflake.operators.snowflake import SnowflakeOperator
   from airflow.providers.common.sql.operators.sql import SQLColumnCheckOperator
   
   my_conn_id = "snowflake_default"
   
   default_args={"conn_id": my_conn_id}
   
   with DAG(
       dag_id="airflow_providers_example",
       schedule=None,
       start_date=datetime(2022, 11, 27),
       default_args=default_args,
   ) as dag:
   
       create_table = SnowflakeOperator(
           task_id="create_table",
           sql="""
               CREATE OR REPLACE TABLE empty_table (
                   col_1 VARCHAR,
                   col_2 VARCHAR,
                   col_3 INT
               )
               """
       )
   
       column_checks = SQLColumnCheckOperator(
           task_id="column_checks",
           table="empty_table",
           column_mapping={
               "col_3": {"min": {"greater_than": 0}}
           },
       )
   
       create_table >> column_checks
   ```
   
   Will fail:`"col_3": {"min": {"greater_than": 0}}` or `col_1: {min: 
{greater_than: 5}}`
   
   But will pass: ``"col_3": {"min": {"geq_to": 0}}`
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to