hussein-awala commented on code in PR #30418:
URL: https://github.com/apache/airflow/pull/30418#discussion_r1155352421


##########
airflow/providers/neo4j/hooks/neo4j.py:
##########
@@ -61,12 +61,29 @@ def get_conn(self) -> Driver:
 
         is_encrypted = self.connection.extra_dejson.get("encrypted", False)
 
-        self.client = GraphDatabase.driver(
-            uri, auth=(self.connection.login, self.connection.password), 
encrypted=is_encrypted
-        )
+        self.client = self.get_client(self.connection, is_encrypted, uri)
 
         return self.client
 
+    def get_client(self, conn: Connection, encrypted: bool, uri: str) -> 
Driver:
+        """
+        Function to determine that relevant driver based on extras.
+        :param conn: Connection object.
+        :param encrypted: boolean if encrypted connection or not.
+        :return: Neo4jDriver
+        """
+        # Self signed certificates
+        ssc = conn.extra_dejson.get("certs_self_signed", False)
+
+        # Only certificates signed by CA.
+        trusted_ca = conn.extra_dejson.get("certs_trusted_ca", False)
+
+        if trusted_ca or ssc:
+            driver = GraphDatabase.driver(uri, auth=(conn.login, 
conn.password))
+        else:
+            driver = GraphDatabase.driver(uri, auth=(conn.login, 
conn.password), encrypted=encrypted)

Review Comment:
   I don't understand why providing  `encrypted=False` in the connection extra 
is not enough to solve the problem, and why we need to ignore `encrypted`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to