lquery
Try bring C# linq to python 馃巿.
The library is a demo, not for production (yet).
Compare with Others
Different between lquery and others (linq for python like asq):
lquery try convert func (from bytecode) to SQL and query from database process.
Compare with CSharp
For C#:
IQueryable<?> query = null;
var items = query.Where(z => z.Name == 's').Select(z => z.Value).ToList();
So for python:
query: Queryable = None;
expr = query.where(z => z.name == 's').select(z => z.value).to_list();
for in-memory iterable
from lquery import enumerable
query: Queryable = enumerable([1, 2, 3])
# then query it
for mongodb
from lquery.extras.mongodb import MongoDbQuery
collection = # get a collection from pymongo
query: Queryable = MongoDbQuery(collection)
# then query it
linq APIs
to_memory - same as AsEnumerable() from C#
where
select
select_many
take
skip
read more examples from unittests.
Others
print reduce info
Print reduce info is easy way to check what query will compile to SQL.
code example:
>>> from lquery.extras.mongodb import MongoDbQuery
>>> mongo_query = MongoDbQuery(None)
>>> reduce_info = mongo_query\
... .where(lambda x: (x['size']['h'] == 14) & (x['size']['uom'] == 'cm'))\
... .skip(1)\
... .where(lambda x: x['size']['w'] > 15)\
... .get_reduce_info()
>>> reduce_info.print()
reduce info of:
Queryable()
.where(<function <lambda> at 0x0000025DBC661EA0>)
.skip(1)
.where(<function <lambda> at 0x0000025DBE957840>)
=>
[SQL] where(<function <lambda> at 0x0000025DBC661EA0>)
[SQL] skip(1)
[MEM] where(<function <lambda> at 0x0000025DBE957840>)
you can see the 1st where() and 1st skip() was success compile to SQL, and 2nd where() only work inside python process.
Metadata
Release files for lquery 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| lquery-0.1.1.tar.gz | 14.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lquery-0.1.1-py3.6.egg | Legacy Egg format | - | - | Details |
Total release size: 86.3 kB
Release files / lquery-0.1.1.tar.gz
| Download URL | lquery-0.1.1.tar.gz |
|---|---|
| Size | 14.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ec5a8d2accba628fbf7695c869ce4c6e1f96dfa5caa8dc0c53d7a37e2bfdf2ed
|
|
BLAKE2b-256 checksum How to use checksums |
71a79f2bad5b662b1954893b636fa9210b6a2e474368b87fe14ba4bcd503a8ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Python-urllib/3.6
|
Release files / lquery-0.1.1-py3.6.egg
| Download URL | lquery-0.1.1-py3.6.egg |
|---|---|
| Size | 71.6 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
5fc3b6232ffbcb07dce1c7e6c1801ba9a9c19cab9f4ec50f30afdaf385bdc5f0
|
|
BLAKE2b-256 checksum How to use checksums |
b51569a167153e2421b288ffc6e3d8b72bbf0335452e8fdc1100e7d9b759f7a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Python-urllib/3.6
|
Security for lquery 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.