You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Darren Weber (Jira)" <ji...@apache.org> on 2019/10/01 01:06:00 UTC

[jira] [Updated] (AIRFLOW-5576) relation "variable" does not exist - psycopg2 - DagBag import

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

Darren Weber updated AIRFLOW-5576:
----------------------------------
    Description: 
While loading dags during a db-reset, before creating any DAG, some code attempts to get/set a Variable, e.g.

```

val = Variable.get(key, default_var=None)
 # or

val = Variable.setdefault(key, default="value")

```

On sqlite3 it's all fine, but not on postgres.

```

[SQL: SELECT variable.val AS variable_val, variable.id AS variable_id, variable.key AS variable_key, variable.is_encrypted AS variable_is_encrypted 
 FROM variable 
 WHERE variable.key = %(key_1)s 
 LIMIT %(param_1)s]
 [parameters: \\{'key_1': 'dag_enabled', 'param_1': 1}]
 (Background on this error at: [http://sqlalche.me/e/f405])
 ERROR [airflow.models.dagbag.DagBag] Failed to import: /home/joe/jupiter/cis/airflow/dags/cis/fsp/dags/dag_generator.py
 Traceback (most recent call last):
 File "/home/joe/.cache/pypoetry/virtualenvs/dags-py3.6/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1249, in _execute_context
 cursor, statement, parameters, context
 File "/home/joe/.cache/pypoetry/virtualenvs/dags-py3.6/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 552, in do_execute
 cursor.execute(statement, parameters)
 psycopg2.ProgrammingError: relation "variable" does not exist
 LINE 2: FROM variable

```

  was:
While loading dags during a db-reset, before creating any DAG, some code attempts to get/set a Variable, e.g.

```

val = Variable.get(key, default_var=None)

# or

val = Variable.setdefault(key, default="value")

```

On sqlite3 it's all fine, but not on postgres.

```

[SQL: SELECT variable.val AS variable_val, variable.id AS variable_id, variable.key AS variable_key, variable.is_encrypted AS variable_is_encrypted 
FROM variable 
WHERE variable.key = %(key_1)s 
 LIMIT %(param_1)s]
[parameters: \{'key_1': 'mia002_hazard2mbtiles', 'param_1': 1}]
(Background on this error at: http://sqlalche.me/e/f405)
ERROR [airflow.models.dagbag.DagBag] Failed to import: /home/joe/jupiter/cis/airflow/dags/cis/fsp/dags/dag_generator.py
Traceback (most recent call last):
 File "/home/joe/.cache/pypoetry/virtualenvs/dags-py3.6/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1249, in _execute_context
 cursor, statement, parameters, context
 File "/home/joe/.cache/pypoetry/virtualenvs/dags-py3.6/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 552, in do_execute
 cursor.execute(statement, parameters)
psycopg2.ProgrammingError: relation "variable" does not exist
LINE 2: FROM variable

```


> relation "variable" does not exist - psycopg2 - DagBag import
> -------------------------------------------------------------
>
>                 Key: AIRFLOW-5576
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-5576
>             Project: Apache Airflow
>          Issue Type: Bug
>          Components: DAG, database
>    Affects Versions: 1.10.5
>            Reporter: Darren Weber
>            Priority: Major
>
> While loading dags during a db-reset, before creating any DAG, some code attempts to get/set a Variable, e.g.
> ```
> val = Variable.get(key, default_var=None)
>  # or
> val = Variable.setdefault(key, default="value")
> ```
> On sqlite3 it's all fine, but not on postgres.
> ```
> [SQL: SELECT variable.val AS variable_val, variable.id AS variable_id, variable.key AS variable_key, variable.is_encrypted AS variable_is_encrypted 
>  FROM variable 
>  WHERE variable.key = %(key_1)s 
>  LIMIT %(param_1)s]
>  [parameters: \\{'key_1': 'dag_enabled', 'param_1': 1}]
>  (Background on this error at: [http://sqlalche.me/e/f405])
>  ERROR [airflow.models.dagbag.DagBag] Failed to import: /home/joe/jupiter/cis/airflow/dags/cis/fsp/dags/dag_generator.py
>  Traceback (most recent call last):
>  File "/home/joe/.cache/pypoetry/virtualenvs/dags-py3.6/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1249, in _execute_context
>  cursor, statement, parameters, context
>  File "/home/joe/.cache/pypoetry/virtualenvs/dags-py3.6/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 552, in do_execute
>  cursor.execute(statement, parameters)
>  psycopg2.ProgrammingError: relation "variable" does not exist
>  LINE 2: FROM variable
> ```



--
This message was sent by Atlassian Jira
(v8.3.4#803005)