numberoverzero / jsonquery Goto Github PK
View Code? Open in Web Editor NEWBasic json -> sqlalchemy query builder
License: MIT License
Basic json -> sqlalchemy query builder
License: MIT License
As noted in the readme, this::
{
"column": "name"
"operator": "like"
"value": {
"operator": "or",
"value": [
"Bill",
"Mary",
"Steve"
]
}
}
is much more readable than this::
{
"operator": "or",
"value": [
{
"column": "name",
"operator": "like",
"value": "Bill"
},
{
"column": "name",
"operator": "like",
"value": "Mary"
},
{
"column": "name",
"operator": "like",
"value": "Steve"
},
]
}
By collapsing the redundant information (column and operator) the intent is much more readable.
Concerns while implementing:
like
operator for 11 names but then use ilike
the operator for "Mary"? Could they make the element a node that overrides operator, or do they have to nest the above in another OR to include the field?http://jsonquery.readthedocs.org/, that is
Refactor the hardcoded type mappings to support arbitrary type/operator/function sets.
This doesn't need to use import magic to load extensions that are defined in some odd place. A simple solution could involve a global function on the module::
def add_type_mapping(column_type, opfunc_map):
TYPE_OPERATORS[column_type] = opfunc_map
Important: This will require formalizing what the call signature is for a function defined in opfunc_map. Currently it works out that it be a function that takes in column and value and returns a criteria on that column (for that value) but this should be spelled out somewhere.
Only supporting String and Integer is kind of embarrassing.
The following types (and their public bases, if any) are available:
BigInteger (Integer)
Boolean ()
Date ()
DateTime ()
Enum (String)
Float (Numeric)
Integer ()
LargeBinary ()
Numeric ()
PickleType (alias of LargeBinary)
SchemaType ()
SmallInteger (Integer)
String (Concatenable)
Text (String)
Time ()
Unicode (String)
UnicodeText (Text)
They all map to generic types above except for BINARY
and VARBINARY
which map to _Binary
(protected). These won't be supported.
I don't intend to support all of these - for the first round, the following will be added:
Boolean
Date
DateTime
Numeric
Time
Once these are implemented, all of the following will be usable:
BigInteger
Boolean
Date
DateTime
Enum
Float
Integer
Numeric
SmallInteger
String
Text
Time
Unicode
UnicodeText
The following will not be usable:
LargeBinary
PickleType (alias of LargeBinary)
SchemaType
These likely won't see support until there's a pluggable framework in place for extending built-in column definitions.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.