I am trying to configure the SQL server in Airflow with sql_alchemy_conn. Airflow is running in the Linux server and DB is in windows. I have just started exploring Airflow, can anyone help me with this.
Asked
Active
Viewed 1,550 times
1 Answers
2
I suppose you mean MySql so for configuring mysql with your airflow you just have to create a database in your system for the respective airflow and add the below line to the airflow.cnf file, save it.
sql_alchemy_conn = mysql://{USERNAME}:{PASSWORD}@{MYSQL_HOST}:3306/airflow
then do database initialising in your terminal
$ airflow initdb
Check out this article for a clear vission.

Anonymous
- 55
- 7
-
Thanks, I know for MySQL and PostgresSQL it a bit easy. But here I want to connect with MSSQL only. – Sanjib Banerjee May 08 '20 at 11:42
-
Check this out- https://stackoverflow.com/questions/54038713/airflow-scheduler-with-sql-server-backend-and-pyodbc – Anonymous May 08 '20 at 12:08
-
But I'll recommend you to use either mysql or postgres:) – Anonymous May 08 '20 at 12:10
-
yes i agree, but currentluy i dont have option other than mssql. Added below command in cfg file: sql_alchemy_conn = mssql+pyodbc://username:pwd@dns Throwing below error: "Could not parse rfc1738 URL from string %s % name sql server" – Sanjib Banerjee May 08 '20 at 12:49
-
I'm not sure but your connection string should be something like this ```sql_alchemy_conn = mssql+pyodbc://airflowuser#afdsqlserver76:
#afdsqlserver76.database.windows.net:1433/airflowdb?driver=ODBC+Driver+17+for+SQL+Server``` Are you following the format properly? – Anonymous May 08 '20 at 13:09 -
hopefully yes. with the same format, I am able to connect from python to the SQL server. now only one doubt, as my password contains '=' symbol that is the reason I am getting Error as "Could not parse rfc1738 URL from string 'my_conn_string". got help from https://stackoverflow.com/questions/1423804/writing-a-connection-string-when-password-contains-special-characters used mssql+pyodbc://username:pwd@dns % urllib.parse.quote_plus('badpass') option as well. – Sanjib Banerjee May 08 '20 at 13:33
-
Not a solution though but maybe try changing your password for an instance to check whether its causing this error or not – Anonymous May 08 '20 at 14:25