tags:

views:

754

answers:

4
+9  Q: 

LINQ in Python

Is there any LINQ-like project for Python that can automatically query XML files and/or RDBMS tables? The syntax does not have to be exactly like LINQ in C#, but hopefully close in a pythonic way.

+3  A: 

If you are looking for an ORM then there is SQLAlchemy

Rick J
Elixir, which is a declarative layer on top of the SQLAlchemy, is easy and convenient to use. http://elixir.ematia.de/
sunqiang
+7  A: 

Pynq implements expression trees:

http://wiki.github.com/heynemann/pynq

Microsoft created Linq (Language Integrated Query) using Expression trees, which is a math concept on how to parse operations into trees in a way that you can analyze the operations independently from the result.

Pynq is an implementation in Python of the Expression Tree theory and some of the providers. There will be more providers gradually, but Pynq will strive to make it as easy as possible to write your own provider.

ars
+1  A: 

I don't know much about Linq but you may be interested in this:

http://code.activestate.com/recipes/442447/

It allows using generator expressions to query an SQL database.

fraca7
+2  A: 

I'm not an expert, but the Dejavu people claims Dejavu makes much of what LINQ does, and did it way before LINQ. Could be worth checking out:

http://us.pycon.org/2009/conference/schedule/event/70/

Lennart Regebro