[sqlalchemy] subclass mapped class to add utility methods?

2010-12-06 Thread Daniel Holth
I am trying to subclass a mapped class from another package for no other reason than to add a utility method. The polymorphic_on condition, if it were defined, would have to be 'True'. Example: class Mapped(declarative_base()): # columns class Utility(Mapped): def is_something(self):

[sqlalchemy] Re: subclass mapped class to add utility methods?

2010-12-06 Thread Daniel Holth
Thank you! I never would have thought of appending a superclass as an alternative to subclassing or monkeypatching. No wonder Python is so hard to optimize. I wound up doing the monkey patch and it seems to work just fine. -- You received this message because you are subscribed to the Google Grou

[sqlalchemy] Re: autocommit on for DDL

2011-01-28 Thread Daniel Holth
You might be interested to know that the situation is more like "If you are not using MySQL, you probably have transactional DDL". Even SQLite has it. According to http://wiki.postgresql.org/wiki/Transactional_DDL_in_PostgreSQL:_A_Competitive_Analysis - PostgreSQL - yes - MySQL - n

[sqlalchemy] Re: can some one give me sample on using max with session.query?

2011-02-01 Thread Daniel Holth
session.query(sqlalchemy.func.max(MappedClass.column)).scalar() -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...

[sqlalchemy] Transactional DDL and SQLite?

2011-02-17 Thread Daniel Holth
Can someone help me understand why DDL seems to not be transactional here: import sqlalchemy e = sqlalchemy.create_engine('sqlite://') c = e.connect() t = c.begin() c.execute("CREATE TABLE foo (bar INTEGER)") t.rollback() assert u'foo' in e.table_names() # True But, if I start up `sqlite3 db.db`

Re: [sqlalchemy] Transactional DDL and SQLite?

2011-02-18 Thread Daniel Holth
Thanks Mike. I will have to edit the pysqlite C source code if I want to prevent it from committing when the query does not contain any of the strings "select", "insert", "update", "delete", or "replace". if (!strcmp(buf, "select")) { return STATEMENT_SELECT; } else if (!strcmp(b

Re: [sqlalchemy] Transactional DDL and SQLite?

2011-02-18 Thread Daniel Holth
It looks like SQLAlchemy 0.7's events make it a lot easer to prepend /* select */ to every statement. Daniel -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from th

Re: [sqlalchemy] Transactional DDL and SQLite?

2011-02-18 Thread Daniel Holth
I thought I could prepend /* update * / to every statement but that didn't work. Instead, https://bitbucket.org/dholth/pysqlite/changeset/cdc3a85dcb49 Obviously it should be a flag. Something like pysqlite2.surprise_transactions(False) -- You received this message because you are subscribed to

[sqlalchemy] stucco_evolution 0.33 released!

2011-02-28 Thread Daniel Holth
ber) tuple for each managed package. stucco_evolution is 200 lines of code with automated tests that provide 100% statement coverage. It works well for me, but the functions in the API do not have very good names. Suggestions welcome. Daniel Holth -- You received this message because you are

[sqlalchemy] Re: Migrating from 0.4.8 (yes 0.4.8)

2011-04-18 Thread Daniel Holth
You should expect better ORM performance in newer versions. You should go straight to 0.6 and see what happens, with an eye on the 0.5 and 0.6 release notes for the things that most people have to change (it shouldn't be a big deal). RunSnakeRun is supposed to be a nifty profiler. Can you profi

Re: [sqlalchemy] Re: replacing or altering a mapper?

2011-04-25 Thread Daniel Holth
I suppose you explicitly don't want to call User.morestuff.otherproperty? I like doing it that way, but it could be that I am underusing SQLAlchemy's inheritance features. The following works fine: package 1: Base1 = declarative_base() class User(Base1): pass package 2: Base2 = declarative_ba

Re: [sqlalchemy] sqlite transaction isolation, select for update, race condition

2011-04-27 Thread Daniel Holth
Is this pysqlite issue about SELECT not starting a transaction related? http://code.google.com/p/pysqlite/issues/detail?id=21 -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com. To un

[sqlalchemy] Re: Query results not Integers

2011-05-03 Thread Daniel Holth
The query is simply returning rows with one column. For example session.query(X.a, X.b).all() would return a potentially less surprising list rows with two columns. The rows can be indexed by name or number. The 'L' is just Python telling you it is a long integer. -- You received this message

[sqlalchemy] stucco_evolution 0.4 released

2012-04-19 Thread Daniel Holth
stucco_evolution 0.4 has been released. It is a migration tool for SQLAlchemy that attempts to deal with packaged dependencies having their own migration scripts. Reading -> as "depends on", web application -> openid package -> users/groups package web application -> users/groups package When a

Re: [sqlalchemy] stucco_evolution 0.4 released

2012-04-19 Thread Daniel Holth
On Thursday, April 19, 2012 1:43:59 PM UTC-4, Michael Bayer wrote: > > If you've seen my recent talks you saw that I'm a little skeptical of what > you're terming "non-monolithic" databases.Let's say this means, a > database with a set of tables maintained by entirely different packages, > b

Re: [sqlalchemy] stucco_evolution 0.4 released

2012-04-19 Thread Daniel Holth
> > So there you have it. It very well may be that there is exactly one use > case for this package, but who doesn't need to keep track of users and > groups? Other than that it does a passable job of applying hand-written > linear database upgrades, and it is short. > > that it is, and the su

[sqlalchemy] Announcing progress_sa

2009-12-17 Thread Daniel Holth
A SQLAlchemy dialect that can be used to read OpenEdge 10 (aka Progress) databases over ODBC. I only use it to read from the database so although it is useful it is certainly incomplete. There is enough there to make queries against reflected tables. It was remarkably easy to implement against S

[sqlalchemy] Re: nested transactions with zope extension

2009-12-23 Thread Daniel Holth
On Dec 21, 6:27 pm, gizli wrote: > Hi all, > > This is only for people who use the zope extension for SA (http:// > pypi.python.org/pypi/zope.sqlalchemy). Consider the following: > > for task in conn.query(Task): >       conn.begin_nested() >       try: >             conn.delete(task) >          

[sqlalchemy] MySQL schema and character_Set_results

2007-04-25 Thread Daniel Holth
I need schema support and "it works at all" support in MySQL, so I had to change these things. It was'n't "character_Set_results" it was "character_set_results". The older MySQL 4? doesn't have this value at all. Hopefully I will be fully upgraded in a few weeks. MySQL 4.0.24: show variables lik

[sqlalchemy] Re: MySQL schema and character_Set_results

2007-04-25 Thread Daniel Holth
P.S. My application uses reflection. For MySQL it would make so much sense to combine "table exists" with "show me the table", since they are the same request. We should cache the result. --~--~-~--~~~---~--~~ You received this message because you are subscribed t