Skip to content

Querying DB Views using Ormar #970

@idrissbellil

Description

@idrissbellil

Is your feature request related to a problem? Please describe.
I have a complex DB view that relies on other views and would like to use Ormar to query data in that view. What worked partially is to create the model class and set the primary_key=True in one of the fields (although it's duplicated everywhere). I could fetch data but I was only receiving entries with unique primary_key.

Describe the solution you'd like
Allow model descriptions without primary_key

Describe alternatives you've considered
Receive entries in which the primary_key field is duplicated

Additional context
I considered bypassing the DB Views and use the original tables with ormar models, but it brought some additional complexity that I was trying to keep in the DB.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions