Skip to main content

Description

A simple decorator to speed up development using flask_sqlalchemy, place the decorator pass the model and done! it works!

Usage/Examples

Place the @filter_query passing the model as argument and enjoy!

Usage example on users endpoint with Users model:

@users.route('/users', methods=["GET"])
@filter_query(Users)
def get_users(*args, **kwargs):
    return make_response(jsonify(kwargs.get('data')), total=kwargs.get('total')), 200)

then you can make a http request passing arguments:

curl --location 'http://127.0.0.1:5000/users?email__like__=%gabriel%&id__eq__=2

response example:

{
    "data": [
        {
            "email": "gabriel.ligoski@gmail.com",
            "id": 2,
            "username": "ligoski"
        }
    ],
    "total": 1
}

currently supported filters:

  • gte
    • Example: curl --location 'http://127.0.0.1:5000/users?id__gte__=2
  • gt
    • Example: curl --location 'http://127.0.0.1:5000/users?id__gt__=2
  • lte
    • Example: curl --location 'http://127.0.0.1:5000/users?id__lte__=2
  • lt
    • Example: curl --location 'http://127.0.0.1:5000/users?id__lt__=2
  • like
    • Example: curl --location 'http://127.0.0.1:5000/users?email__like__=%gabriel%
  • in
    • Example: curl --location 'http://127.0.0.1:5000/users?email__in__=gabriel.ligoski@gmail.com,admin@gmail.com,teste@hotmail.com
  • eq
    • Example: curl --location 'http://127.0.0.1:5000/users?id__eq__=2

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flask_sqlalchemy_magic_query-0.1.3.3.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file flask_sqlalchemy_magic_query-0.1.3.3.tar.gz.

File metadata

File hashes

Hashes for flask_sqlalchemy_magic_query-0.1.3.3.tar.gz
Algorithm Hash digest
SHA256 b2f22eec91900b295d798ffa1aeb31d52eb6533b465ef481626de53d0187eacc
MD5 af0d540de6a75f40355710f0002f70ea
BLAKE2b-256 ff48dd2614bf627debdffa750b922a811764b41273aea378f1285a418e7d5b06

See more details on using hashes here.

File details

Details for the file flask_sqlalchemy_magic_query-0.1.3.3-py3-none-any.whl.

File metadata

File hashes

Hashes for flask_sqlalchemy_magic_query-0.1.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7228bf2ec4ebb274a0076f8e5da38fcd3ef2e5dae43f7ed41bc27d955db7bf7f
MD5 bc704df929e0e25c28932fff8b03bc17
BLAKE2b-256 660f944149c1fdf0d81f4345b3a5918dbf4b484ef137df6ec660545973384410

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.3.3 This release

2 files

0.1.3.2

1 file

0.1.3.1

1 file

0.1.3

1 file

0.1.2

1 file

0.1.1

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page