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


Groups > comp.lang.python > #50898 > unrolled thread

Designing a Pythonic search DSL for SQL and NoSQL databases

Started byAlec Taylor <alec.taylor6@gmail.com>
First post2013-07-19 22:25 +1000
Last post2013-07-20 00:55 +1000
Articles 3 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  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

#50898 — Designing a Pythonic search DSL for SQL and NoSQL databases

FromAlec Taylor <alec.taylor6@gmail.com>
Date2013-07-19 22:25 +1000
SubjectDesigning a Pythonic search DSL for SQL and NoSQL databases
Message-ID<mailman.4864.1374236715.3114.python-list@python.org>
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.

[toc] | [next] | [standalone]


#50899

FromRoy Smith <roy@panix.com>
Date2013-07-19 08:49 -0400
Message-ID<roy-52F6B8.08493719072013@70-1-84-166.pools.spcsdns.net>
In reply to#50898
In article <mailman.4864.1374236715.3114.python-list@python.org>,
 Alec Taylor <alec.taylor6@gmail.com> wrote:

> Dear Python community,
> 
> I am analysing designing an abstraction layer over a select few NoSQL
> and SQL databases.
> 
> Specifically:
> 
> - Redis, Neo4j, MongoDB, CouchDB
> - PostgreSQL

This isn't really a Python question.

Before you even begin to think about "how to do this in Python", you 
need to think about "how to do this at all".  You've got a huge range of 
storage paradigms there.  Redis is basically a key-value store.  Mongo 
does documents.  Postgres does relations.  I'm not familiar with Neo and 
Couch, but I assume they also have their own interesting ways of storing 
things.

You need to figure out what it means to abstract search over such a 
diverse range of technologies.  I honestly don't think it's possible, 
but maybe you've got some good ideas.  In any case, you need to figure 
that part out before you even begin to think about how to implement it 
in any particular language.

[toc] | [prev] | [next] | [standalone]


#50909

FromAlec Taylor <alec.taylor6@gmail.com>
Date2013-07-20 00:55 +1000
Message-ID<mailman.4874.1374245753.3114.python-list@python.org>
In reply to#50899
Hmm, looking at the capabilities of Redis; you're likely right.

Would welcome discussion on the implementability and usefulness of a
central search abstraction to the other stores mentioned.

One thing could be that using the paradigm the database was made for
is better than any advantages abstracting their differences creates.

On Fri, Jul 19, 2013 at 10:49 PM, Roy Smith <roy@panix.com> wrote:
> In article <mailman.4864.1374236715.3114.python-list@python.org>,
>  Alec Taylor <alec.taylor6@gmail.com> wrote:
>
>> Dear Python community,
>>
>> I am analysing designing an abstraction layer over a select few NoSQL
>> and SQL databases.
>>
>> Specifically:
>>
>> - Redis, Neo4j, MongoDB, CouchDB
>> - PostgreSQL
>
> This isn't really a Python question.
>
> Before you even begin to think about "how to do this in Python", you
> need to think about "how to do this at all".  You've got a huge range of
> storage paradigms there.  Redis is basically a key-value store.  Mongo
> does documents.  Postgres does relations.  I'm not familiar with Neo and
> Couch, but I assume they also have their own interesting ways of storing
> things.
>
> You need to figure out what it means to abstract search over such a
> diverse range of technologies.  I honestly don't think it's possible,
> but maybe you've got some good ideas.  In any case, you need to figure
> that part out before you even begin to think about how to implement it
> in any particular language.
> --
> http://mail.python.org/mailman/listinfo/python-list

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web