sqlalchemy

Dynamic Table Creation and ORM mapping in SqlAlchemy

I'm fairly new to using relational databases, so I prefer using a good ORM to simplify things. I spent time evaluating differing Python SQL libraries and I think SQLAlchemy is what I need. However, I've come to a mental dead end. I need to create a new table to go along with each instance of a player I create in my app's player table....

How can i write my own aggregate functions with sqlalchemy?

How can I write my own aggregate functions with SQLAlchemy? As an easy example I would like to use numpy to calculate the variance. With sqlite it would look like this: import sqlite3 as sqlite import numpy as np class self_written_SQLvar(object): def __init__(self): import numpy as np self.values = [] def step(self, value)...

Problems with SQLAlchemy and VirtualEnv

I'm trying to use SQLAlchemy under a virtualenv on OS X 10.5, but cannot seem to get it to load whatsoever. Here's what I've done mkvirtualenv --no-site-packages test easy_install sqlalchemy I try to import sqlalchemy from the interpreter and everything works fine, but if i try to import sqlalchemy from a python script, I get the fol...

Configuring Django to use SQLAlchemy

how we configure django with SQLAlchemy?? ...

simple update in sqlalchemy

Hello all, UserTable is: id (INT) name (STR) last_login (DATETIME) Serving a web page request i have a user id in hand and I only wish to update the last_login field to 'now'. It seems to me that there are 2 ways: issue a direct SQL using db_engine (losing the mapper) OR query the user first and then update the object Both work...

working with django and sqlalchemy but backend mysql

i am working with python django framework but in model part is sqlalchemy and back end data base is mysql how i will configure them??? ...

SQLAlchemy: Object Mappings lost after commit?

Hey everyone, I got a simple problem in SQLAlchemy. I have one model in a table, lets call it Model1 here. I want to add a row in this table, and get the autoincremented key, so I can create another model with it, and use this key. This is not a flawed database design (1:1 relation etc). I simply need this key in another table, because ...

Is there anything similar to SQLAlchemy?

I've recently started to fell in love with SQLAlchemy. You can write clean and fast SQL statements without having to write one line of SQL. There is no need to write most of the meta configuration you would need for something like Hibernate. At work I managed to create a mapper for a table which doesn't have a primary key! I can have com...

Auto-incrementing attribute with custom logic in SQLAlchemy

Hi everyone! I have a simple "Invoices" class with a "Number" attribute that has to be assigned by the application when the user saves an invoice. There are some constraints: 1) the application is a (thin) client-server one, so whatever assigns the number must look out for collisions 2) Invoices has a "version" attribute too, so I can't...

Is Pylons enterprise-ready?

I am a developer who is looking for an Enterprise-ready web application framework for Python. My main concern is long-term support, extensive feature set and reliability. I have been experimenting with Pylons and after my horrendous experience with Ruby on Rails on Windows where I even had to compile my own Postgres driver, Pylons and P...

Dynamic where clause in sqlahcmey

Hello I am trying to make the where clause in sqlalchemy for where condition like a==b and id in(1,2,3,4,5) and (x==y or t==y) i get input as [['a==b'], 'and', [<object of sqlalchemmy binary expression>], 'and', '(', ['x==y'], 'or', ['t==y'], ')'] Now from this list input i want to make the where expression. I tried making all...

Group by & count function in sqlalchemy

I want a "group by and count" command in sqlalchemy. How can I do this? ...

Execute a prepared statement in sqlalchemy

I have to run 40K requests against a username: SELECT * from user WHERE login = :login It's slow, so I figured I would just use a prepared statement. So I do e = sqlalchemy.create_engine(...) c = e.connect() c.execute("PREPARE userinfo(text) AS SELECT * from user WHERE login = $1") r = c.execute("EXECUTE userinfo('bob')") for x in r...

Use SQLite's backup API from Python/SQLAlchemy

I'm using an SQLite database from python (with SQLAlchemy). For performance reasons, I'd like to populate an in-memory database in the application, and then back up that database to disk. SQLite has a backup API, which seems would do this transparently. The APSW documentation says that it wraps the backup API, but I'd like to access th...

Sqlalchemy - Difference between query and query.all in for loops

Hello everyone, I would like to ask whats the difference between for row in session.Query(Model1): pass and for row in session.Query(Model1).all(): pass is the first somehow an iterator bombarding your DB with single queries and the latter "eager" queries the whole thing as a list (like range(x) vs xrange(x)) ? ...

Python sqlachemy - how to make table partitions?

I am not very familiar with databases, and so I do not know how to partition a table using sqlachemy... Your help would be greatly appreciated. ...

python sqlalchemy performance?

HI , I made a ICAPServer (similar with httpserver) for which the performance is very important. The DB module is sqlalchemy. I then made a test about the performance of sqlalchemy, as a result, i found that it takes about 30ms for sqlalchemy to write <50kb data to DB (Oracle), i don`t know if the result is normal, or i did something wron...

python program choice

My program is ICAPServer (similar with httpserver), it's main job is to receive data from clients and save the data to DB. There are two main steps and two threads: ICAPServer receives data from clients, puts the data in a queue (50kb <1ms); another thread pops data from the queue, and writes them to DB SO, if 2nd step is too slow, th...

python sqlalchemy parallel operation

HI,i got a multi-threading program which all threads will operate on oracle DB. So, can sqlalchemy support parallel operation on oracle? tks! ...

sqlalchemy document

HI i was reading the chapter 8.3.7 -- Oracle API Reference of sqlalchemy0.5.4 official document. When talking about connection ,there is a parameter called threaded : threaded - enable multithreaded access to cx_oracle connections. Defaults to True. Note that this is the opposite default of cx_oracle itself. Not understand the "this is...