Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #50898

Designing a Pythonic search DSL for SQL and NoSQL databases

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <alec.taylor6@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'open-source': 0.04; 'syntax': 0.04; 'inspired': 0.05; 'sufficient': 0.05; 'postgresql': 0.07; 'abstraction': 0.09; 'additionally': 0.09; 'subset': 0.09; 'python': 0.11; 'analysing': 0.16; 'mongodb,': 0.16; 'subject:search': 0.16; 'think?': 0.16; 'thanks,': 0.17; 'community,': 0.19; 'select': 0.22; 'all:': 0.24; 'skip:` 20': 0.24; "i've": 0.25; 'references': 0.26; 'message- id:@mail.gmail.com': 0.30; 'layer': 0.31; 'search.': 0.31; 'table,': 0.31; 'maybe': 0.34; 'advice': 0.35; 'received:google.com': 0.35; 'object,': 0.36; 'being': 0.38; 'feedback': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; "you'll": 0.62; 'name': 0.63; 'dear': 0.65; 'alec': 0.84; 'subject:SQL': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=+RkueYFfSxv1O1rZqjlk4077gKQ/8l3nd0qhQ+F750U=; b=IP69tfa0fgjUAh6zX1T2T94nhze+rk5RHB02q/h5FzKwFnjrPXE1foynHt34ye/Wjt iWWV7GaXoozYlnCKnMRig0F24AxK0g+No5uIB+aGrnnpoa3bfohYc2BoonERfArLJ1KI jZfX0ilP7hQg8J8Q2+uzwJEPQ0rWqt2YO6+Khjllyx+nvFBWt/p6Wh7rmn27lIfIoJ57 +vJRSz0XYgooNDYsQJwxV1cbztLLe+TYDaBAiRMQt1zaeJjkaon30RnNC1JViXUCtfvY Mn9oIMn7y/9+yeAwr7M4pz/Q9tdPgdbom+GPz+hhiJlcgyMYYmDlQP4g+9s4BxSg/P1w c4Ug==
MIME-Version 1.0
X-Received by 10.42.132.3 with SMTP id b3mr10180328ict.98.1374236707096; Fri, 19 Jul 2013 05:25:07 -0700 (PDT)
Date Fri, 19 Jul 2013 22:25:07 +1000
Subject Designing a Pythonic search DSL for SQL and NoSQL databases
From Alec Taylor <alec.taylor6@gmail.com>
To "comp.lang.python" <python-list@python.org>
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4864.1374236715.3114.python-list@python.org> (permalink)
Lines 40
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1374236715 news.xs4all.nl 15890 [2001:888:2000:d::a6]:43010
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:50898

Show key headers only | View raw


Dear Python community,

I am analysing designing an abstraction layer over a select few NoSQL
and SQL databases.

Specifically:

- Redis, Neo4j, MongoDB, CouchDB
- PostgreSQL

Being inexperienced; it is hard to know a nice way of abstracting search.

For conciseness in my explanation, think of `Table` as being table,
object, entity or key; and `name` as being name or type.

Maybe `res = Table.name.search(<attr_list with conditions>)`

Or on multiple `Table`:
`res = AbstractDB().AbstractSearch(<Table.attr_list with conditions>
<conditions> <Table.attr_list with conditions>)`

Then: `res.paginate(limit=25, offset=5)`

Or if you want all: `res.all()`

And additionally borrow/alias from a relevant subset of PEP249, e.g.:
`fetchone` and `fetchmany`

Will open-source this once it's of sufficient functionality.

What do you think?

Advice on better design; or just feedback on what I've mentioned?

Thanks,

Alec Taylor

PS: I am using Bottle. You'll note that some of the syntax I've
references is inspired from web2py's DAL and ODMG.

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Designing a Pythonic search DSL for SQL and NoSQL databases Alec Taylor <alec.taylor6@gmail.com> - 2013-07-19 22:25 +1000
  Re: Designing a Pythonic search DSL for SQL and NoSQL databases Roy Smith <roy@panix.com> - 2013-07-19 08:49 -0400
    Re: Designing a Pythonic search DSL for SQL and NoSQL databases Alec Taylor <alec.taylor6@gmail.com> - 2013-07-20 00:55 +1000

csiph-web