You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Jarek Potiuk (Jira)" <ji...@apache.org> on 2020/01/19 23:23:00 UTC

[jira] [Resolved] (AIRFLOW-1429) Unable to add connections programatically if user/pass in the URI contain special characters

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

Jarek Potiuk resolved AIRFLOW-1429.
-----------------------------------
    Resolution: Invalid

Not valid any more

> Unable to add connections programatically if user/pass in the URI contain special characters
> --------------------------------------------------------------------------------------------
>
>                 Key: AIRFLOW-1429
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-1429
>             Project: Apache Airflow
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 1.7.1.3
>         Environment: Ubuntu 14.04
>            Reporter: Luke Grzela
>            Priority: Major
>
> Hello,
> I hit a problem with adding FTP connections to airflow programmatically.
> If there is a question mark in the username or password part of the FTP uri, i.e. if the URI is something like ftp://joe:my?pass@someftp.com, then everything before the questionmark will be treated as the URI and the rest I suppose is considered to be the query string, I tried replacing the ? with %3F, but it didn't help.
> Here's our code for adding the connection:
> {noformat}
> from airflow import settings
> from airflow.models import Connection
> def add_connection(conn_id, uri): 
>   """ 
>   Add a connection to airflow's list of known connections.    
>   This function is internal, you can call it if you want,    
>   but best to use one of the above 'public' functions. 
>   """    
>   conn = Connection(conn_id=conn_id, uri=uri)    
>   session = settings.Session()    
>   existing_conn = session.query(Connection).filter(Connection.conn_id == conn_id).first()    
>   if existing_conn:        
>     session.delete(existing_conn)    
>     session.add(conn)    
>     session.commit()    
>     session.close()
> {noformat}
> Is there any way to escape the question marks and any other special characters?
> Thanks,
> Luke



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