Segfault-Inc / Multicorn

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

How to debug failed attempt to use Write API? #110

Closed johnmudd closed 9 years ago

johnmudd commented 9 years ago

I'm trying to use the write API. I started by trying to execute an INSERT. Got the following.

ERROR:  Error in python: NotImplementedError

I see that I need the rowid_column() method. So I added that. And set self.row_id_column in the __init__() method. And added stubs for insert, update, delete, commit, rollback and pre_commit. Each of these call a log function. None appear to get called though. All I get now is the following.

LOG:  statement: INSERT INTO shipping (reference) VALUES(NULL)
LOG:  server process (PID 12047) was terminated by signal 11

How do I debug this?

John

mmautner commented 9 years ago

+1

Any guidance about debugging stuff like this is really, really welcome.

rotten commented 9 years ago

I have a couple of tips at the bottom of my Hue lightbulb FDW readme.md: https://github.com/rotten/hue-multicorn-postgresql-fdw

I also have a couple of tips in the PPT that went with the presentation for that FDW.

It makes sense to roll a bunch of debug tips into a document. If I have a good week at work this week, I'll send a pull request with a /debugging/readme.md file to get it started.

My first suggestion to address that error for update/insert was to make sure you have rowid set:

############
# We need to overload this function so Updates will work
@property
def rowid_column(self):
    return self._row_id_column

I see you got that one already. Hmm.

Do you also set it in init? --

    # We need to identify the "primary key" column so we can do updates:
    self._row_id_column = 'light_id'
johnmudd commented 9 years ago

You gave me the answer. I had not added the @property decorator to my rowid_column() method. Now it works. Thanks!

On Mon, Aug 24, 2015 at 6:27 AM, Rick Otten notifications@github.com wrote:

I have a couple of tips at the bottom of my Hue lightbulb FDW readme.md: https://github.com/rotten/hue-multicorn-postgresql-fdw

I also have a couple of tips in the PPT that went with the presentation for that FDW.

It makes sense to roll a bunch of debug tips into a document. If I have a good week at work this week, I'll send a pull request with a /debugging/ readme.md file to get it started.

My first suggestion to address that error for update/insert was to make sure you have rowid set:

############

We need to overload this function so Updates will work

@property def rowid_column(self): return self._row_id_column

I see you got that one already. Hmm.

Do you also set it in init? --

We need to identify the "primary key" column so we can do updates:

self._row_id_column = 'light_id'

— Reply to this email directly or view it on GitHub https://github.com/Kozea/Multicorn/issues/110#issuecomment-134136190.