New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

sqla-filters-yaml

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sqla-filters-yaml

YAML parser for sqla-filters.

  • 0.0.1
  • PyPI
  • Socket score

Maintainers
1

Sqla-filters-yaml

Add yaml parser to the sqla-filters package.

Introduction

Add YAML support to sqla-filters.

Requirements

This package use the python package pyyaml. To install pyyaml you need to have the yaml.h header file. If it's not present on your system you need to install the libyaml-dev package.

  • On Fedora
sudo dnf install libyaml-devel
  • On Debian based distribution (Ubuntu, ...)
sudo apt install libyaml-dev

Installation

pip install sqla-filter-yaml

Getting Started

YAML format

---
type: and
data:
- type: or
  data:
  - type: operator
    data:
      attribute: name
      operator: eq
      value: toto
  - type: operator
    data:
      attribute: name
      operator: eq
      value: tata
- type: operator
  data:
    attribute: age
    operator: eq
    value: 21

:warning: Yaml format can change in the futur. :warning:

Example code

Create an instance of the YAMLilterParser from the yaml string / document.

Example:

# Sqlalchemy setup + model definition

# Create a YAML parser instance
parser = YAMLiltersParser(raw_json_string)

# You can finaly filter your query
query = session.query(Post)
filtered_query = parser.tree.filter(query)

# Get the results
query.all()

Result tree

                                      +----------------------+
                                      |                      |
                                      |          and         |
                                      |                      |
                                      -----------------------+
                                                 ||
                                                 ||
                                                 ||
                    +----------------------+     ||     +----------------------+
                    |                      |     ||     |                      |
                    |          or          <------------>      age == 21       |
                    |                      |            |                      |
                    +----------------------+            +----------------------+
                               ||
                               ||
                               ||
+----------------------+       ||       +----------------------+
|                      |       ||       |                      |
|     name == toto     <---------------->     name == tata     |
|                      |                |                      |
+----------------------+                +----------------------+

Contribute

Fork the repository and run the following command to install the dependencies and the dev dependencies.

pip install -e '.[dev]'

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc