Skip to content

rowid_column difficulties #257

@Lobstros

Description

@Lobstros

Hey,

I'm having a trouble setting rowid_column when implementing a write API, and am trying to work out if it's a bug, or me being slow—any help appreciated!

I see that, in the source of the abstract class ForeignDataWrapper, rowid_column is a @property method that raises NotImplementedError, presumably to enforce that child classes override it. But, this means that when I do try to set it, Python angrily throws AttributeError (I guess it expects a setter method or something). So, whether you try to set it or not, it ends up running to one of the two exceptions.

I've ended up forcing the redefinition by doing this:

class MyFDW(ForeignDataWrapper):

    def __init__():
        <snip>
        self._rowid_column = "colname"

    @property
    def rowid_column:
        return self._rowid_column

It seems to work, but I'm worried that it's heavy-handed magic. Was it intended behaviour?

BTW, I notice the property spelled differently in the docs (row_id_column), but the source only makes reference to rowid_column. That did look like a simple typo, though the tests also seem to use the double-underscore variant too. Do they pass, and I'm just missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions