Segfault-Inc / Multicorn

Data Access Library
https://multicorn.org/
PostgreSQL License
700 stars 145 forks source link

RFC: Allow SPI Calls from inside of Multicorn Python #224

Open rbiro opened 5 years ago

rbiro commented 5 years ago

Not suitable for merging

Here are a couple of simple changes that allow making SPI calls from inside of multicorn. We use them to do field translation as well as update tables based on the results of api calls to other data storage providers. We are about to start pounding on them.

While we are doing the final debugging and testing, I wanted to get an idea of the interest in having them cleaned up and prepared for a merge.

Please comment here on your interest and about specific cleanups you think are necessary. e.g. should the Statement class be moved out to it's own file? Would using the standard pypl extensions be better than these extensions? etc.

rdunklau commented 4 years ago

Hello,

I'm not sure what you are trying to provide here, but at least on python3 I just added the fact that we can import the plpy module directly from Multicorn. Maybe that would make things simpler if you could use plpy.execute ?

rbiro commented 4 years ago

We're still on python2, but plpy would be a better solution.

Ross

On Tue, Mar 10, 2020 at 2:14 AM Ronan Dunklau notifications@github.com wrote:

Hello,

I'm not sure what you are trying to provide here, but at least on python3 I just added the fact that we can import the plpy module directly from Multicorn. Maybe that would make things simpler if you could use plpy.execute ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Segfault-Inc/Multicorn/pull/224?email_source=notifications&email_token=AFA35FJPR5FMNYS3EXD6F63RGXLC7A5CNFSM4HSNUE3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOKE5XQ#issuecomment-596922078, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFA35FMDFW7S7CQACU24AUTRGXLC7ANCNFSM4HSNUE3A .

-- Ross Biro | CTO


O: 240-380-2231| F: 240-556-0361 <(240)%20556-0361> The Interface Financial Group https://interfacefinancial.com/

CONFIDENTIALITY NOTICE: This email message, including any attachments, is for the sole use of the intended recipient/s and may contain confidential & privileged information. Any unauthorized review, use, disclosure, or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original messages and any attachments.

rbiro commented 4 years ago

Am I missing something? If multicorn is called outside of a plpython function, then anytime pyly.prepare or probably others is called, you get an error.

ERROR: Error in python: InternalError DETAIL: no Python function is currently executing

It looks to me like the context is initialized in plpy_main.c by a static function PLy_push_execution_context().

I don't see a way to work around that without modifying plpy_main.c.

Ross

On Tue, Mar 10, 2020 at 8:26 AM Ross Biro rbiro@interfacefinancial.com wrote:

We're still on python2, but plpy would be a better solution.

Ross

On Tue, Mar 10, 2020 at 2:14 AM Ronan Dunklau notifications@github.com wrote:

Hello,

I'm not sure what you are trying to provide here, but at least on python3 I just added the fact that we can import the plpy module directly from Multicorn. Maybe that would make things simpler if you could use plpy.execute ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Segfault-Inc/Multicorn/pull/224?email_source=notifications&email_token=AFA35FJPR5FMNYS3EXD6F63RGXLC7A5CNFSM4HSNUE3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOKE5XQ#issuecomment-596922078, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFA35FMDFW7S7CQACU24AUTRGXLC7ANCNFSM4HSNUE3A .

-- Ross Biro | CTO


O: 240-380-2231| F: 240-556-0361 <(240)%20556-0361> The Interface Financial Group https://interfacefinancial.com/

CONFIDENTIALITY NOTICE: This email message, including any attachments, is for the sole use of the intended recipient/s and may contain confidential & privileged information. Any unauthorized review, use, disclosure, or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original messages and any attachments.

-- Ross Biro | CTO


O: 240-380-2231| F: 240-556-0361 <(240)%20556-0361> The Interface Financial Group https://interfacefinancial.com/

CONFIDENTIALITY NOTICE: This email message, including any attachments, is for the sole use of the intended recipient/s and may contain confidential & privileged information. Any unauthorized review, use, disclosure, or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original messages and any attachments.