Re: Calling stored procredure from psycopg2

From: Ed Behn <ed(at)behn(dot)us>
To: psycopg(at)lists(dot)postgresql(dot)org
Subject: Re: Calling stored procredure from psycopg2
Date: 2018-01-23 17:52:42
Message-ID: CAJBL5DOm5LcEO4oM1JOvBz7M+c315qX4n5h=f=wkzzmGfNJCuw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

The search_path is documented:
https://www.postgresql.org/docs/current/static/ddl-schemas.html#DDL-SCHEMAS-PATH

Essentially, it's the order in which postgres tries to find the object that
you used in a query. (It has nothing to do with file system directories).
Alternatively, you can explicitly reference the schema in your query. (ie
SELECT *schema_name*.func(...) )

On Tue, Jan 23, 2018 at 12:28 PM, Graeme Gemmill <graeme(at)gemmill(dot)name>
wrote:

> On 23/01/18 14:56, Daniele Varrazzo wrote:
>
>> On Tue, Jan 23, 2018 at 2:00 PM, Graeme Gemmill <graeme(at)gemmill(dot)name>
>> wrote:
>>
>>> Environment is Mageia 5 x86_64, Python 3.4, Postgresql 9.3.20,
>>> psycopg2-2.7.1
>>>
>>> I have a working application that calls an external sql stored procedure
>>> called search.sql with entry point "search_columns". I access it with the
>>> statement self.cursor.callproc('search_columns', (target,))
>>>
>>> I have moved that application to the following environment: Mageia 6
>>> x86_64,
>>> Python 3.5, Postgresql 9.6.6, psycopg2-2.7.3.2. I now get an error
>>> message:
>>>
>>> psycopg2.ProgrammingError: function search_columns(unknown) does not
>>> exist
>>>
>>> search.sql is in the same directory as other Python modules, so there
>>> seems
>>> to have been a change in how to call stored sql procedures. Can someone
>>> help
>>> please?
>>>
>> David, Daniele: thank you for replying.
> David: the search routine works correctly in one environment, so I don't
> think raw SQL is the answer
> Daniele: What would be the 'search_path'? As I said, 'search.sql' is in
> the same directory as other Python modules used by the application, and no
> path variable was set when I first copied the code from Stack Exchange and
> tested it.
> I can find no references to path/environment in Postgresql's documentation
> of pl/pgsql.
> Regards
> Graeme
>
>

In response to

Browse psycopg by date

  From Date Subject
Next Message Rory Campbell-Lange 2018-01-23 17:54:27 Re: Calling stored procredure from psycopg2
Previous Message Graeme Gemmill 2018-01-23 17:28:31 Re: Calling stored procredure from psycopg2