Re: [sqlalchemy] ...and MVC

2015-05-26 Thread Burak Arslan
hello, On 05/25/15 16:51, c.bu...@posteo.jp wrote: I know there is no absolute solution for my question. I just want to hear your suggestions and how you do this in your practice. In which layer of the MVC-pattern are all the SQLAlchemy objects located? There should be a Session for each

Re: [sqlalchemy] ...and MVC

2015-05-26 Thread David Allouche
On 26 May 2015, at 09:16, Burak Arslan burak.ars...@arskom.com.tr wrote: same here but before passing the model instance from controller to view, all instances are detached from session (via expunge()). this 1) prevents a lot of unexpected db queries. 2) lets you recycle db connections as

[sqlalchemy] difference between expunge() and make_transient()

2015-05-26 Thread c.buhtz
Can someone explain me the difference between expunge() and make_transient() please. Of course I read the docs (more than one time) about it. But I am not really sure about the difference. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To

Re: SQlite migration with batch mode - help needed

2015-05-26 Thread Mike Bayer
On 5/26/15 9:47 AM, Sylvain Martel wrote: Hi, Not knowing much about SQL stuff, I used Flask-Migrate, which use alembic, to deal with migrations. But now I have to deal with a migration where I can't simply destroy the SQLite database and remake it.(which is how I dealt so far when an

Re: [sqlalchemy] ...and MVC

2015-05-26 Thread Mike Bayer
On 5/26/15 7:26 AM, David Allouche wrote: On 26 May 2015, at 09:16, Burak Arslan burak.ars...@arskom.com.tr wrote: same here but before passing the model instance from controller to view, all instances are detached from session (via expunge()). this 1) prevents a lot of unexpected db queries.

[sqlalchemy] relationship(with lazy=dynamic) different behavior on session.delete() btw. SA 0.9.3 and SA 1.0.4

2015-05-26 Thread g
Hi all With SA 1.0.4 I can delete rows that i could not delete with SA 0.9.3 . MODEL. Base = declarative_base() class Node(Base): __tablename__ = 'node' id = Column(Integer, primary_key=True) parent_id = Column(Integer, ForeignKey('node.id')) data = Column(String(50))

Re: SQlite migration with batch mode - help needed

2015-05-26 Thread Sylvain Martel
P.S. I tried this: def upgrade(): ### commands auto generated by Alembic - please adjust! ### with op.batch_alter_table(incomes) as batch_op: batch_op.add_column(sa.Column('income_classtype', sa.Integer(), nullable=True)) batch_op.create_foreign_key(None, 'incomes',

Re: [sqlalchemy] Session.close() implicite

2015-05-26 Thread Jonathan Vanasco
Michael- FYI, memoized_property isn't documented. it looks to be in the active source, and there is a recipe for a roll-your-own memoized orm properties. On Monday, May 25, 2015 at 11:43:58 AM UTC-4, c.b...@posteo.jp wrote: I am quite new to Python and not familiar with the decorator

[sqlalchemy] Issue with XML type and ibm_db_sa

2015-05-26 Thread skinless8
Hi, I am getting this error when trying to do query() and CreateTable() with XML data type on db2 database. (Using ibm_db_sa) Any suggestions how to resolve this? from sqlalchemy import create_engine from sqlalchemy import MetaData from sqlalchemy import Table from sqlalchemy.schema import

[sqlalchemy] Re: ...and MVC

2015-05-26 Thread Jonathan Vanasco
In most implementations, the answer would be: None of the above. Many MVC style frameworks (including all the near variants) will place the SqlAlchemy session management in a WSGI middleware layer or a tween. Usually it will look like (pseudocode): try:

Re: [sqlalchemy] relationship(with lazy=dynamic) different behavior on session.delete() btw. SA 0.9.3 and SA 1.0.4

2015-05-26 Thread Mike Bayer
On 5/26/15 11:18 AM, g wrote: Hi all With SA 1.0.4 I can delete rows that i could not delete with SA 0.9.3 . your code is relying on a bug in 0.9.3 that was fixed in 0.9.5 (https://bitbucket.org/zzzeek/sqlalchemy/issue/3060) , but we broke other things at the same time and ultimately it

Re: [sqlalchemy] difference between expunge() and make_transient()

2015-05-26 Thread Mike Bayer
On 5/26/15 11:37 AM, c.bu...@posteo.jp wrote: Can someone explain me the difference between expunge() and make_transient() please. Of course I read the docs (more than one time) about it. But I am not really sure about the difference. expunge sends a persistent object to the detached state.

Re: [sqlalchemy] Issue with XML type and ibm_db_sa

2015-05-26 Thread Mike Bayer
On 5/26/15 1:11 PM, skinle...@gmail.com wrote: Hi, I am getting this error when trying to do query() and CreateTable() with XML data type on db2 database. (Using ibm_db_sa) Any suggestions how to resolve this? | fromsqlalchemy importcreate_engine fromsqlalchemy importMetaData