From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
---|---|
To: | Marcos Ortiz <mlortiz(at)uci(dot)cu>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Trying to solve a SocketError [Errno 13] Permission with PL/Python in PostgreSQL 9.3 |
Date: | 2015-05-23 22:40:51 |
Message-ID: | 556101F3.4030401@aklaver.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 05/23/2015 03:27 PM, Marcos Ortiz wrote:
> Regards to all the list.
> First all the info about the system:
>
> O.S: CentOS 7 64 bits
> PostgreSQL version:
>
> SELECT version();
> version
> --------------------------------------------------------------------------------------------------------------
>
> PostgreSQL 9.2.7 on x86_64-redhat-linux-gnu, compiled by gcc (GCC)
> 4.8.2 20140120 (Red Hat 4.8.2-16), 64-bit
> (1 row)
>
> Neo4j version: 2.1.M
> Py2neo version: 2.0.8
> Python version:
> python
> Python 2.7.5 (default, Jun 17 2014, 18:11:42)
> [GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux2
>
> Now the problem:
>
> We are working here to integrate PostgreSQL with Neo4j through PL/Python
> using the py2neo module for it, and when we want to send sentences to
> Neo4j using port 7474, the executed code raises a SocketError [Errno 13]
> Permission denied.
Well first in the code below, if I am following correctly, the socket is
37474.
>
> I tested the same code in a normal python script outside of PostgreSQL,
> and it works well, but the problem is when I use the code inside
> PostgreSQL with PL/Python.
Second the plpythonu code is running as the postgres user, so does that
user have permissions on the socket.
> This is the code of a simple function to search a node in the Neo4j graph:
>
> CREATE OR REPLACE FUNCTION search_professor_node(nombre_prof text)
> RETURNS text AS
> $BODY$
> from py2neo import Graph
> from py2neo.cypher import CypherTransaction
>
> graph = Graph("http://neo4j:neo4j(at)10(dot)8(dot)45(dot)136:37474/db/data")
> tx = graph.cypher.begin()
> statement = "MATCH (pf:Professor) WHERE pf.nombre = {name} RETURN pf;" ,
> tx.append(statement, parameters={'name': nombre_prof})
> professor= tx.commit()
> $BODY$
> LANGUAGE plpythonu VOLATILE
> COST 100;
>
> and it can be used:
> SELECT search_professor_node('Max');
>
> The completed error is:
>
> ********** Error **********
>
> ERROR: py2neo.packages.httpstream.http.SocketError: Permission denied
> SQL state: XX000
> Context: Traceback (most recent call last):
> PL/Python function "search_professor_node", line 6, in <module>
> tx = graph.cypher.begin()
> PL/Python function "search_professor_node", line 666, in cypher
> PL/Python function "search_professor_node", line 212, in metadata
> PL/Python function "search_professor_node", line 257, in get
> PL/Python function "search_professor_node", line 965, in get
> PL/Python function "search_professor_node", line 942, in __get_or_head
> PL/Python function "search_professor_node", line 432, in submit
> PL/Python function "search_professor_node", line 361, in submit
> PL/Python function "search_professor_node"
>
> Thanks a lot for your time, and I hope to find a suitable solution for it.
>
>
--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Marcos Ortiz | 2015-05-23 22:46:37 | Re: Trying to solve a SocketError [Errno 13] Permission with PL/Python in PostgreSQL 9.3 |
Previous Message | Tom Lane | 2015-05-23 22:38:57 | Re: Trying to solve a SocketError [Errno 13] Permission with PL/Python in PostgreSQL 9.3 |