Oh ok that makes sense and I can easily use this. Thank you! On Fri, Jan 15, 2010 at 2:03 PM, Michael Bayer <[email protected]>wrote:
> Stephen Mullins wrote: > > Cool thank you. I take it that means there's no way to do this if I'm > just > > using a Base model and a session. > > > > I had been just doing: > > session.add(myobj) > > session.commit() > > > > where myobj is an instance of a model class that inherits from Base, I > > hadn't been creating Table objects directly. > > The mechanics here is that the Table object, whether you create it or > declarative does, is used by the Mapper to generate an insert() construct > during a flush. > > There's no hook to receive and modify this insert() construct within the > mapper's procedure, but if you wanted this Table to use that syntax for > all INSERT statements, a recipe I just gave someone on this list a couple > of weeks ago is at > > http://groups.google.com/group/sqlalchemy/browse_thread/thread/a7e05537ae504d61/bf2cc95ac2ae5cd1?lnk=gst&q=prefix_with#bf2cc95ac2ae5cd1 > > When using declarative, the attributes on the Table are still easy to > specify (via __table_args__) and modify (via cls.__table__) so that > doesn't get in the way here. > > > > > > On Fri, Jan 15, 2010 at 11:38 AM, Michael Bayer > > <[email protected]>wrote: > > > >> Stephen wrote: > >> > I didn't see anything in the docs or in this group so please forgive > >> > me if this has been asked already. > >> > > >> > If I'm using sqlalchemy with an underlying mysql db, how can I achieve > >> > INSERT DELAYED? > >> > > >> > I saw this changeset on the wiki: > >> > http://www.sqlalchemy.org/trac/changeset/4236 > >> > > >> > But I don't understand how to take advantage of this through the > >> > sqlalchemy api. Is the only way to get this through: > >> > scoped_session(..).connection(...).execute("sql command") > >> > >> myinsert = table.insert().prefix_with("DELAYED") > >> > >> session.execute(myinsert) > >> > >> > >> > >> > >> -- > >> You received this message because you are subscribed to the Google > >> Groups > >> "sqlalchemy" group. > >> To post to this group, send email to [email protected]. > >> To unsubscribe from this group, send email to > >> [email protected]<sqlalchemy%[email protected]> > <sqlalchemy%[email protected]<sqlalchemy%[email protected]> > > > >> . > >> For more options, visit this group at > >> http://groups.google.com/group/sqlalchemy?hl=en. > >> > >> > >> > >> > > -- <br /> > > > > You received this message because you are subscribed to the Google Groups > > "sqlalchemy" group.<br /> > > > > To post to this group, send email to [email protected].<br /> > > > > To unsubscribe from this group, send email to > > [email protected]<sqlalchemy%[email protected]>.<br > /> > > > > For more options, visit this group at > > http://groups.google.com/group/sqlalchemy?hl=en.<br /> > > > > > > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<sqlalchemy%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/sqlalchemy?hl=en. > > > >--
You received this message because you are subscribed to the Google Groups "sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
