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

New sqlalchemy filtering errors #75

Open
mahenzon opened this issue Jan 23, 2024 · 1 comment
Open

New sqlalchemy filtering errors #75

mahenzon opened this issue Jan 23, 2024 · 1 comment
Assignees

Comments

@mahenzon
Copy link
Member

mahenzon commented Jan 23, 2024

0: error processing invalid filters (value instead of val)

[
  {
    "name": "meta",
    "op": "eq",
    "val": {"foo":  "bar"}
  }
]

You'll get an error here:

return set(filter_item.keys()) == terminal_node_keys

1: error processing json

Try creating a filter like this:

[
  {
    "name": "meta",
    "op": "eq",
    "val": {"foo":  "bar"}
  }
]

The problem is here:

# for Union annotations
if schema_field.sub_fields:
fields = list(schema_field.sub_fields)

@mahenzon mahenzon changed the title Error 'str has no attribute keys' in is_terminal_node New sqlalchemy filtering errors Jan 23, 2024
@mahenzon
Copy link
Member Author

mahenzon commented Jan 23, 2024

можно взять как отправную точку вот такую переделку. Но надо ещё списки обрабатывать

fields = {
    schema_field.name: (schema_field.outer_type_, schema_field.field_info),
}

class Config:
    arbitrary_types_allowed = True

# Create the model using create_model
ValidationModel = pydantic.create_model(
    "ValidationModel",
    **fields,
    __config__=Config,
)
validated = ValidationModel.parse_obj({schema_field.name: value})
val = getattr(validated, schema_field.name)
return getattr(model_column, operator)(val)

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

No branches or pull requests

2 participants