Uploaded image for project: 'Apache Airflow'
  1. Apache Airflow
  2. AIRFLOW-5576

relation "variable" does not exist - psycopg2 - DagBag import

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.10.5
    • Fix Version/s: None
    • Component/s: DAG, database
    • Labels:
      None

      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.  The traceback is like:

       

      [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
      

       

      versions:

      $ pip freeze | grep airflow
      apache-airflow==1.10.5
      $ pip freeze | grep sqlalchemy
      marshmallow-sqlalchemy==0.19.0
      $ pip freeze | grep psycopg2
      psycopg2==2.7.7
      
      

       

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              dazza Darren Weber
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: