Re: [sqlalchemy] What's the idiomatic way of writing INSERT... ON DUPLICATE KEY UPDATE

2012-02-01 Thread Didip Kerabat
/p5grh/sqlalchemy_whats_the_idiomatic_way_of_writing/ > > I mentioned ticket #960 as where we'd someday support "MERGE" and its > variants, but this can also be rolled with @compiles, see the example in that > ticket. > > http://www.sqlalchemy.org/trac/ticket/960 > > > On Jan 31, 2012, at

[sqlalchemy] What's the idiomatic way of writing INSERT... ON DUPLICATE KEY UPDATE

2012-01-31 Thread Didip Kerabat
when using SqlAlchemy Core (not using Session/ORM)? I have quite a few tables with composite primary keys that can use it for optimization. At the moment what I have is quite ghetto, below is a contrive example of it: stmt = str(user_table.insert().values(email=email, name=name)) stmt +=

[sqlalchemy] session.execute().fetchall() without optional arguments problem with mysql

2010-06-19 Thread Didip Kerabat
Hi all, when running engine.execute("my query without optional escaped arguments").fetchall(), /Library/Python/2.6/site-packages/SQLAlchemy-0.6beta1-py2.6.egg/sqlalchemy/engine/base.py: self.__distill_params returns an empty tuple. but, inside /Library/Python/2.6/site-packages/MySQLdb/curso

[sqlalchemy] Re: Testing SQLAlchemy based app? (Tutorial?)

2009-08-13 Thread Didip Kerabat
nose works by running python files and methods that contain the word 'test', some people use nose to call their UnitTest objects. But you don't have to do this, you can get up to speed by using assert x == y for example. As 1 possible implementation, you can have setup() method in your test file t

[sqlalchemy] Re: can't compare offset-naive and offset-aware datetimes

2009-08-13 Thread Didip Kerabat
Print out your Table object, see if that column was defined as you expected by reflect() On Aug 13, 2009, at 3:29 AM, Julien Cigar wrote: > > I just tried : > > datetime(2009, 13, 12, 10, 12, tzinfo=pytz.timezone('Europe/ > Brussels')) > > instead of : > > datetime(2009, 13, 12, 10, 12) > >

[sqlalchemy] Re: django like inspectdb

2009-08-10 Thread Didip Kerabat
Dusan, I believe you can use declarative_base to define your ORM, and then either use autoload=True on its Table object, or set Base.metadata.reflect(bind=your_db_engine) to reflect all of your db tables. See: http://www.sqlalchemy.org/docs/05/ormtutorial.html http://www.sqlalchemy.org/docs/0

[sqlalchemy] Re: Looking for examples of SQLAlchemy in WSGI apps

2009-07-13 Thread Didip Kerabat
I think Werkzeug guys talk about this before. Werkzeug is barebone WSGI tools, which might suits your need? Hopefully this link helps: http://dev.pocoo.org/projects/werkzeug/wiki/SQLAlchemyAndWerkzeug - Didip - On Mon, Jul 13, 2009 at 8:15 AM, Matt Wilson wrote: > > I'm writing a really tiny W

[sqlalchemy] Re: timestamp as int

2009-07-02 Thread Didip Kerabat
If you define your column as DateTime, then SA will use the db's datetime column. If you want to store time in integer, i think you can just set the column to integer, and set the column value as int(time.time()) - Didip - On Thu, Jul 2, 2009 at 9:52 AM, Lukasz Szybalski wrote: > > Hello, > Wha

[sqlalchemy] Re: SQLAlchemy as a FIFO buffer?

2009-06-30 Thread Didip Kerabat
If you are open to non RDBMS solution, sounds like what you need is message queue system. At work, we use RabbitMQ (memory-only) and have been quite happy with it. SecondLife posted their discovery about MQ here: http://wiki.secondlife.com/wiki/Message_Queue_Evaluation_Notes - Didip - On Mon, J

[sqlalchemy] Re: introspecting models

2009-06-26 Thread Didip Kerabat
I believe you can look inside object's __dict__ for list of field names. There are plenty of information you can pull from orm.Mapper. Those are explained better here: http://www.sqlalchemy.org/docs/05/reference/orm/mapping.html - Didip - On Thu, Jun 25, 2009 at 6:12 PM, Chris Withers wrote:

[sqlalchemy] Re: Migration from django orm: override save method?

2009-06-15 Thread Didip Kerabat
Quick note about __init__ method. SA select(..) or query(...) does not call __init__(), so your to upper logic won't be executed then. If you want it to be called every object construction you need to do this: from sqlalchemy import orm @orm.reconstructor def some_function(): self.field1=field

[sqlalchemy] Re: insert statment

2009-06-08 Thread Didip Kerabat
You have Syntax Error here: ('sdsd':'sdsds') That one should be tuple right? - Didip - On Mon, Jun 8, 2009 at 6:14 AM, Ash wrote: > > Hello , > > I am trying to insert in the table using two ways in the values which > i show below > > engine = sqlalchemy.create_engine() > metadata = MetaData(

[sqlalchemy] Re: SQLAlchemy for c++

2009-06-08 Thread Didip Kerabat
If you are looking for ORM in c++, maybe this conversation can help: http://stackoverflow.com/questions/74141/good-orm-for-c-solutions - Didip - On Sun, Jun 7, 2009 at 11:56 PM, Jarrod Chesney wrote: > > Hi All > Does anyone knows where i can find information about using SQLAlchemy > from c++ o