sqlalchemy

User Authentication in Pylons + AuthKit

I am trying to create a web application using Pylons and the resources on the web point to the PylonsBook page which isn't of much help. I want authentication and authorisation and is there anyway to setup Authkit to work easily with Pylons? I tried downloading the SimpleSiteTemplate from the cheeseshop but wasn't able to run the setup-...

Getting random row through SQLAlchemy

How do I select a(or some) random row(s) from a table using SQLAlchemy? ...

Best way to access table instances when using SQLAlchemy's declarative syntax.

all the docs for sql alchemy give INSERT and UPDATE examples using the local table instance (i.e. tablename.update()... ) doing this seems difficult with the declarative syntax, I need to reference Base.metadata.tables["tablename"] for get the table reference. Am I sposed to do this another way? Is there a different syntax for INSERT...

Opinions on DBCook?

Hi everyone! I'm looking for opinions on the DBCook framework as a declarative wrapper for SQLAlchemy.. Has anyone used it? Thanks for your time! ...

Is it OK to inspect properties beginning with underscore?

I've been working on a very simple crud generator for pylons. I came up with something that inspects SomeClass._sa_class_manager.mapper.c Is it ok to inspect this (or to call methods begining with underscore)? I always kind of assumed this is legal though frowned upon as it relies heavily on the internal structure of a class/object. ...

SQLAlchemy and kinterbasdb in separate apps under mod_wsgi

I'm trying to develop an app using turbogears and sqlalchemy. There is already an existing app using kinterbasdb directly under mod_wsgi on the same server. When both apps are used, neither seems to recognize that kinterbasdb is already initialized Is there something non-obvious I am missing about using sqlalchemy and kinterbasdb in sepa...

How can I use UUIDs in SQLAlchemy?

Is there a way to define a column (primary key) as uuid in sqlalchemy if using postgresql? ...

Pylons with Elixir

I would like to use Pylons with Elixir, however, I am not sure what is the best way to get about doing this. There are several blog posts (cleverdevil, beachcoder, adam hoscilo) and even an entire new framework about how to go about doing this; however, I am not certain about the differences between them. Which one is the best to use? Am...

What's the easiest way/best tutorials to get familiar with SQLAlchemy ?

What are best resources/tutorials for starting up with SQLAlchemy? Maybe some simple step by step stuff like creating a simple table and using it and going up from there. ...

Does SQLAlchemy support caching?

Does SQLAlchemy support some kind of caching so if i have lots of time the same query it would return the response from cache instead of querying the database until i clear the cache for that query because i updated de db? Or what's the best way to implement this on a CherryPy,SQLAlchemy setup? ...

Group by date in a particular format in SQLAlchemy

I have a table called logs which has a datetime field. I want to select the date and count of rows based on a particular date format. How do I do this using SQLAlchemy? ...

How to specify relations using SQLAlchemy declarative syntax?

I can't find any proper documentation on how to specify relations using the declarative syntax of SQLAlchemy.. Is it unsupported? That is, should I use the "traditional" syntax? I am looking for a way to specify relations at a higher level, avoiding having to mess with foreign keys etc.. I'd like to just declare "addresses = OneToMany(Ad...

How to find out if a lazy relation isn't loaded yet, with SQLAlchemy?

With SQLAlchemy, is there a way to know beforehand whether a relation would be lazy-loaded? For example, given a lazy parent->children relation and an instance X of "parent", I'd like to know if "X.children" is already loaded, without triggering the query. ...

How to add an automatic filter to a relation with SQLAlchemy?

I'm using SQLAlchemy 0.5rc, and I'd like to add an automatic filter to a relation, so that every time it tries to fetch records for that relation, it ignores the "remote" ones if they're flagged as "logically_deleted" (a boolean field of the child table) For example, if an object "parent" has a "children" relation that has 3 records, bu...

Efficiently updating database using SQLAlchemy ORM

I'm starting a new application and looking at using an ORM -- in particular, SQLAlchemy. Say I've got a column 'foo' in my database and I want to increment it. In straight sqlite, this is easy: db = sqlite3.connect('mydata.sqlitedb') cur = db.cursor() cur.execute('update table stuff set foo = foo + 1') I figured out the SQLAlchemy S...

What is the sqlalchemy equivalent column type for 'money' and 'OID' in Postgres?

What is the sqlalchemy equivalent column type for 'money' and 'OID' column types in Postgres? ...

Best way to organize the folders containing the SQLAlchemy models

I use SQLAlchemy at work and it does the job really fine. Now I am thinking about best practices. For now, I create a module holding all the SQLA stuff : my_model |__ __init__.py |__ _config.py <<<<< contains LOGIN, HOST, and a MetaData instance |__ table1.py <<<<< contains the class, the model and the mappe...

How do I put a SQLAlchemy label on the result of an arithmetic expression?

How do I translate something like this into SQLAlchemy? select x - y as difference... I know how to do: x.label('foo') ...but I'm not sure where to put the ".label()" method call below: select ([table.c.x - table.c.y], ... ...

How do I ORDER BY an arithmetic express in SQLAlchemy?

How do I translate something like this into SQLAlchemy? SELECT (a * b) - (x + y) / z AS result FROM table ORDER BY result ...

SQLAlchemy with count, group_by and order_by using the ORM

I've got several function where I need to do a one-to-many join, using count(), group_by, and order_by. I'm using the sqlalchemy.select function to produce a query that will return me a set of id's, which I then iterate over to do an ORM select on the individual records. What I'm wondering is if there is a way to do what I need using t...