Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is Table inheritance possible? #96

Open
Quidge opened this issue Jan 23, 2020 · 3 comments
Open

Is Table inheritance possible? #96

Quidge opened this issue Jan 23, 2020 · 3 comments

Comments

@Quidge
Copy link

Quidge commented Jan 23, 2020

Is building the Dynamodel's subclass Table attribute through inheritance supported?

class BaseTable:
    hash_key = 'someid'
    read = 3
    write = 4


class ActualTable(DynaModel):
    class Table(BaseTable):
        name = 'table-name'

    class Schema:
        someid = fields.String(required=True)

Doing so raises dynamorm.exceptions.MissingTableAttribute: Missing required Table attribute: hash_key errors. I see that the dynamorm metaclass is doing some fancy stuff behind the scenes with the Table attribute, but it does that with Schemas too and Schema inheritance is supported now.

Is there a suggested way to do what I'm looking for with Table inheritance?

@borgstrom
Copy link
Contributor

borgstrom commented Feb 6, 2020

We don't currently support Table inheritance because of the way our meta-class works. We would need to do something similar to #46 where we added support for inheritance on the Model.

@Quidge
Copy link
Author

Quidge commented Feb 9, 2020

Great to know, thank you @borgstrom !

@Quidge
Copy link
Author

Quidge commented Jun 21, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants