Package: duckql
duckQL 🐥duckQL is simple JSON-based notation for some SQL dialects (PostgreSQL, MariaDB, MySQL) based onpydanticlibrary.ExampleHere is a simple example of library usage. For more examples please visitproject page.fromduckqlimportQuery,Property,Comparision,Constantmy_query=Query(entity='users',properties=[Property(name='users.name'),Property(name='users.surname')],conditions=Comparision(properties=[Property(name='users.age'),Constant(value=15)],operation=Comparision.Operation.GREATER_EQUAL)){"obj":"structures.Query","entity":"users","properties":[{"obj":"properties.Property","name":"users.name"},{"obj":"properties.Property","name":"users.surname"}],"conditions":{"obj":"structures.Comparision","properties":[{"obj":"properties.Property","name":"users.age"},{"obj":"properties.Constant","value":"15"}],"operation":"gte"}}SELECTusers.name,users.surnameFROMusersWHERE(users.age>=15);DevelopmentProject is usingpoetryand documentation is generated byMkDocs. If you want to generate documentation you need to follow these simple steps
inside of your virtual environment:poetry installmkdocs buildInside of your virtual environment, you can also usemkdocs serveto create temporary auto-reload http server with
live docs.We usepytestfor unit tests andflake8for code-style validation. You can execute tests inside of pipenv shell using these commands:pytest -v .: executes unit testspytest -v --flake8 .: flake8 code-style testsLicenseMade with ☕️ and ❤️ by Jakub Dubec &BACKBONE s.r.o.Changelog0.13.0  : 2022-06-09Added: Ability to use casting forORDER BYproperty0.12.1 : 2022-05-10Fixed: Corrected cast of JSON fields0.12.0 : 2021-12-21Feature:FirstValuewindow function introducedFeature: PositionalArrayAggintroduced0.11.1 : 2021-12-14Change: Ability to cast to UUID0.11.0 : 2021-12-10Feature: More benevolent type nesting0.10.0 : 2021-11-30Feature:Caseintroduced (without docs, there was no time, sry, let's call it Easter Egg for a while)0.9.1 : 2021-07-20Fix: Fixed problem with multiple properties in operations (I had to remove comparison property check)0.9.0 : 2021-06-25Fix: Fixed nested conditions (Operatorcan contain anotherOperator)Change: Dropped Python 3.6 support0.8.2 : 2020-10-15Fix: Use->instead of-->0.8.1 : 2020-10-15Fix: Use-->operator in JSON lookup chaining in nested objects0.8.0 : 2020-10-14Feature: Nested JSON fields0.7.2 : 2020-08-28Fix: Use->>operator in JSON lookup instead of->(cast result as text)0.7.1 : 2020-08-27Fix: Use quotes in JSON column type keys inProperty0.7.0 : 2020-08-27Feature: Now is possible to passDistincttoCountto haveCOUNT(DISTINCT property)syntax in pSQLTests: Test for JSON column type in pSQL0.6.1 : 2020-08-04Fix: Use nativetyping.Literalif possible (Python 3.8 compatibility fix)0.6.0 : 2020-07-23Feature:lowerfunction introducedFeature:upperfunction introducedFeature: pSQLinitcapfunction introduced0.5.0 : 2020-07-22Feature:QueryFactorysupportingjson,msgpackandbsonFeature: pSQLunaccentfunction introduced0.4.0 : 2020-06-12Feature:Extract.Unit.DAYintroducedFeature:CastOperator.DataType.REALintroducedFeature: pSQLto_charfunction introducedFeature: pSQLto_datefunction introduced0.3.0 : 2020-05-20Feature:HAVINGsupportFeature:NOW()supportFix:Comparisionallows to have everyBaseTypeaspropertiesFix: Interval value is quoted now0.2.2 : 2020-04-16Change: Ability to passstructures.Distinctintofunctions.StringAgg0.2.1 : 2020-04-09Fix: Fixed JOIN aliases0.2.0 : 2020-04-09Project renamed toduckql, this is the first public release (development status modifier changed to beta).Change: Name changed toduckqlChange:Poetryas package manager0.1.8 : 2020-04-07Feature: Subquery supportNote: Changelog datetimes inISO 8601compatibleY-m-dformat0.1.7 : 2020-03-17Fix: Adding missing imports in__init__.pyfiles inside of submodulesChange: Moved__version__from__init__.pytoversion.pyNote: Development status change to Alpha0.1.6 : 2020-03-13Feature: Introducedfunctions.StringAggFeature: Introducedstructures.CastOperatorFeature: CLI for parsing files0.1.5 : 2020-02-05Change: Allow direct use ofstructures.Comparisionin query conditions0.1.4 : 2020-02-05Fix: Allow aliases instructures.QueryChange: Do not escape%0.1.3 : 2020-02-03Feature: Natural join support0.1.2 : 2020-02-03Change: Completed docsFeature: Recursive nested properties lookup inQueryobject0.1.1 : 2020-02-26Change: Default values for optional attributes instructures.QueryChange:custom_parsernow can raiseParseErrorif there is invalid object type passed0.1.0 : 2020-02-26Initial release