apache / airflow

Apache Airflow - A platform to programmatically author, schedule, and monitor workflows
https://airflow.apache.org/
Apache License 2.0
36.82k stars 14.24k forks source link

Issue with Neo4j provider using some schemes #30153

Closed eldar-elne closed 1 year ago

eldar-elne commented 1 year ago

Apache Airflow version

Other Airflow 2 version (please specify below)

What happened

Hi, I've run into some issues when using the neo4j operator. I've tried running a simple query and got an exception from the driver itself. Using: Airflow 2.2.2

What you think should happen instead

The exception stated that when using bolt+ssc URI scheme, it is not allowed to use the encrypted parameter which is mandatory in the hook (but actually not mandatory when using the driver standalone).

The exception: neo4j.exceptions.ConfigurationError: The config settings "encrypted", "trust", "trusted_certificates", and "ssl_context" can only be used with the URI schemes ['bolt', 'neo4j']. Use the other URI schemes ['bolt+ssc', 'bolt+s', 'neo4j+ssc', 'neo4j+s'] for setting encryption settings.

In my opinion: if there's a URI scheme with bolt+ssc, and a GraphDatabase.driver was chosen in the connection settings, it should not be used with the encrypted parameter. I did edit the hook myself and tried this, worked great for me.

How to reproduce

install the neo4j provider (I used v3.1.0) Create a neo4j connection in the UI. Add your host, user/login, password and extras. In the extras: { "encrypted": false, "neo4j_scheme": false, "certs_self_signed": true }

Operating System

Linux

Versions of Apache Airflow Providers

pyairtable==1.0.0 tableauserverclient==0.17.0 apache-airflow-providers-mysql==2.1.1 apache-airflow-providers-salesforce==3.3.0 apache-airflow-providers-slack==4.1.0 apache-airflow-providers-tableau==2.1.2 apache-airflow-providers-postgres==2.3.0 apache-airflow-providers-jdbc==2.0.1 apache-airflow-providers-neo4j==3.1.0 mysql-connector-python==8.0.27 slackclient>=1.0.0,<2.0.0 boto3==1.20.26 cached-property==1.5.2

Deployment

Amazon (AWS) MWAA

Deployment details

No response

Anything else

No response

Are you willing to submit PR?

Code of Conduct

boring-cyborg[bot] commented 1 year ago

Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.

potiuk commented 1 year ago

Feel free to work on it. Assigned you.