Skip to content

complex query #23

Description

@josejachuf

I have the following:

class A(Model):
    a1 = Field.string(length=50)
    a2 = Field.string(length=50)}
    has_many({'b: 'B'})

class B(Model):
    belongs_to({'a': 'A'})
    b1 = Field.string(length=50)
    b2 = Field.string(length=50)
    has_many({'c': 'C'})

class C(Model):
    belongs_to({'b': 'B'})
    c1 = Field.string(length=50)
    c2 = Field.string(length=50)

My Endpoint uses model B. What would be the simplest way to use the where feature, if you can consult by:

a1
c1

He had thought about creating a view and then a model mapping with view. Any better option?

The other thing that occurs to me would be to use this and do everything manually:

@tasks.get_dbset
def fetch_tasks():
    return Task.where(lambda t: t.is_deleted == False)

Activity

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

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