You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Aizhamal Nurmamat kyzy (JIRA)" <ji...@apache.org> on 2019/05/29 03:35:00 UTC

[jira] [Updated] (AIRFLOW-3170) Jinja templating error - to be clearer

     [ https://issues.apache.org/jira/browse/AIRFLOW-3170?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Aizhamal Nurmamat kyzy updated AIRFLOW-3170:
--------------------------------------------
    Component/s: core

> Jinja templating error - to be clearer 
> ---------------------------------------
>
>                 Key: AIRFLOW-3170
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-3170
>             Project: Apache Airflow
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.10.0
>            Reporter: jack
>            Priority: Major
>
> Consider the following code:
> {code:java}
>    import_orders_op = MySqlToGoogleCloudStorageOperator(
>         task_id='import_orders',
>         mysql_conn_id='mysql_conn',
>         google_cloud_storage_conn_id='gcp_con',
>         provide_context=True,
>         sql=''' SELECT * FROM {{ params.table_name }} WHERE orders_id > {{ params.last_imported_id }} AND orders_id < {{ ti.xcom_pull('get_max_order_id') }}''',
>         params={'last_imported_id': LAST_IMPORTED_ORDER_ID, 'table_name' :  BQ_TABLE_NAME},
>         bucket=GCS_BUCKET_ID,
>         filename=file_name,
>         dag=dag){code}
>  
> It gives me:
> {code:java}
> UnicodeDecodeError: 'utf8' codec can't decode byte 0xa0 in position 1:
>  invalid start byte{code}
>  
>  
> This error is unclear. It doesn't say where the problem is or what is the actual cause. It took me hours to trace it to the *missing space* between
> {code:java}
> {{ ti.xcom_pull('get_max_order_id') }}{code}
> and the
> {code:java}
>  '''{code}
>  
>  
> Please improve the error message to explain the +actual problem+. A clear error message that refer to the syntax error near the  '''  would help a lot. This is the kind of error where programmers may lose a lot of time to find because it's very unnoticeable.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)