Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Query language for python objects [closed]

I'm looking for a library that lets me run SQL-like queries on python "object databases". With object database I mean a fairly complex structure of python objects and lists in memory. Basically this would be a "reverse ORM" - instead of providing an object oriented interface to a relational database, it would provide a SQL-ish interface to an object database.

C#'s LINQ is very close. Python's list comprehensions are very nice, but the syntax gets hairy when doing complex things (sorting, joining, etc.). Also, I can't (easily) create queries dynamically with list comprehensions.

The actual syntax could either be string based, or use a object-oriented DSL (a la from(mylist).select(...)). Bonus points if the library would provide some kind of indices to speed up search.

Does this exist or do I have to invent it?

like image 481
jdm Avatar asked Feb 26 '11 12:02

jdm


People also ask

Is Python a query language?

The fundamental difference is that SQL is a query language primarily used for accessing and extracting data, whereas Python is a general-purpose programming language that enables experimentation with the data.

What is object query language with example?

Object Query Language (OQL) is a version of the Structured Query Language (SQL) that has been designed for use in Network Manager. The components create and interact with their databases using OQL.

What is persistent storage of objects in Python?

The Persistent Storage module minimizes database activity by caching retrieved objects and by saving objects only after their attributes change. To relieve code writing tedium and reduce errors, a code generator takes a brief object description and creates a Python module for a persistent version of that object.


1 Answers

Dee is aiming to be SQL (ish; the author prefers relational calculus) for in-memory structures. There's a GROUP BY equivalent and everything.

like image 194
Tobu Avatar answered Sep 26 '22 01:09

Tobu