Skip to content

Commit b3a41bc

Browse files
committed
Modified the description
1 parent 4163999 commit b3a41bc

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,35 @@
11
# pythonql
22
A LINQ type extension to Python that allows language-integrated queries against relational, XML and JSON data, as well an Python's collections
3+
4+
5+
Python has pretty advanced comprehensions, that cover a big chunk of SQL, to the point where PonyORM was able to build a whole ORM system based on comprehensions. However, group by mechanisms, outerjoins and support for semi-structured data are not handled well at all.
6+
7+
8+
We propose the following extensions to Python( that are implemeneted in this demo preprocessor and query executor):
9+
10+
1. Path expressions. When working with nested data that has varied structure, path expressions are extremely useful. We have modeled our path expression on XPath, however we use a much simplified verison:
11+
12+
- Child step: for x in data ./
13+
- Descended step: for x in data .//
14+
- Filter step: for x in data { key == 'green' }
15+
16+
So we can write path expression in the query language (and elsewhere in Python expressions) like this:
17+
18+
- for x in data ./ {key == 'green'} .// { key == 'yellow' }
19+
20+
2. Query expression:
21+
22+
select x, y, sum(w)
23+
for x in data ./,
24+
y = x ./,
25+
w in data 2
26+
group by x,y
27+
where x % 2 == 0
28+
29+
30+
31+
We'll be adding a window and maybe try/catch to the expression, to make it as powerful as a JSONiq query.
32+
33+
34+
The query expressions can be executed on top of any Python collections, but if databases are at the source, the
35+
idea is to push as much work as possible into the database layer.

0 commit comments

Comments
 (0)