Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gisce/ooquery
OpenObject Query Parser
https://github.com/gisce/ooquery
hacktoberfest openerp openobject orm parser query sql
Last synced: about 2 months ago
JSON representation
OpenObject Query Parser
- Host: GitHub
- URL: https://github.com/gisce/ooquery
- Owner: gisce
- License: mit
- Created: 2015-10-07T09:49:35.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-02-06T12:42:55.000Z (almost 2 years ago)
- Last Synced: 2024-11-06T13:51:02.500Z (2 months ago)
- Topics: hacktoberfest, openerp, openobject, orm, parser, query, sql
- Language: Python
- Homepage:
- Size: 115 KB
- Stars: 5
- Watchers: 18
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
****************
OpenObject Query
****************Python 2.7 and >=3.5
.. image:: https://travis-ci.org/gisce/ooquery.svg?branch=master
:target: https://travis-ci.org/gisce/ooquery
.. image:: https://coveralls.io/repos/github/gisce/ooquery/badge.svg?branch=master
:target: https://coveralls.io/github/gisce/ooquery?branch=master
.. image:: https://img.shields.io/pypi/v/ooquery.svg
:target: https://pypi.python.org/pypi/ooqueryParsers OpenObjectes queries like:
.. code-block:: python
import pyscopg2
from oopgrade.oopgrade import get_foreign_keys
from ooquery import OOQueryconn = psycopg2.connect("dbname=test user=postgres")
with conn.cursor() as cursor:
def fk_function(table, field):
fks = get_foreign_keys(cursor, table)
return fks[field]q = OOQuery('account_invoice', fk_function)
sql = q.select(['number', 'state']).where([
('state', '=', 'open'),
('partner_id.name', '=', 'Pepito')
])
cursor.execute(*sql)Support for reading from joined tables
.. code-block:: python
q = OOQuery('account_invoice', fk_function)
sql = q.select(['number', 'partner_id.name', 'partner_id.vat']).where([
('state', '=', 'open')
])