title: why can't connect to databases via airflow connection?
body: <p><a href="https://i.stack.imgur.com/jZ4YV.png" rel="nofollow noreferrer">After pushing my DAG I get this error</a></p>
  <p>I am new to data engineering. I tried to solve this error in different ways at the expense of my knowledge, but nothing worked. I want to write a DAG that consists of two tasks, the first is to export data from one database table on one server as CSV files and import these CSV files into database tables on another server. The variable contains DAG configuration and SQL scripts for exporting and importing data.</p>
  <p>Please tell me how can I solve this error?</p>
  <p>I have this exporting code:</p>
  <pre><code>def export_csv():
      import json
      from airflow.models import Variable
      import pandas as pd
      instruction_data = json.loads(Variable.get('MAIN_SOURCE_DAMDI_INSTRUCTIONS'))
      requirement_data = instruction_data['requirements']
      lst = requirement_data['scripts']
      ms_hook = MsSqlHook(mssql_conn_id='OKTELL')
      connection = ms_hook.get_conn()
      cursor = connection.cursor()
      for i in lst:
          result = cursor.execute(i['export_script'])
          df = pd.DataFrame(result)
          df.to_csv(i['filename'], index=False, header=None, sep=',', encoding='utf-8')
      cursor.close()
  </code></pre>
  <p>And this is my task for exporting:</p>
  <pre><code>export_csv_func = PythonOperator(
      task_id='export_csv_func',
      python_callable=export_csv,
      mssql_conn_id='OKTELL'
  </code></pre>
  <p>P.S. I imported the libraries and airflow variables inside the function because before that there was a lot of load on the server and this method helped to reduce the load.</p>