Jeff Cook wrote:
>
> Dear All People:
>
> I'm using SQLSoup and getting errors like  InvalidRequestError: Can't
> reconnect until invalid transaction is rolled back and MySQL Server
> has gone away. I have set autoflush=True and this has helped mitigate
> some errors, but not these, they happen with varying frequency when I
> haven't restarted the servers for a while. I am almost never using
> db.flush(). Will that fix this? How can I make this things work? I
> really want them to work and I hate MySQL but am stuck using it for
> now.
>
> SQLAlchemy thus far has added several hours to development time, which
> I find sad. I have this block of code:
>         #this has consumed too much time
>         #will come back and fix but for now we have to give up on it
>         #ret = Session.query(sets).select_from(orm.outerjoin((slices,
> slices.asset_slice_asset_id == id), (stores, stores.asset_store_id ==
> slices.asset_slice_store_scheme_id))).filter(id == sets.asset_id).all
> ()
>         #how I hate sqlalchemy right now
>         #the raw query took under five minutes
>         #the other thing took more than hour and still doesn't work
>         ret = db.bind.execute(""" SELECT * FROM assets a
>         LEFT OUTER JOIN asset_slices `as` on as.asset_slice_asset_id =
> a.asset_id
>         LEFT OUTER JOIN asset_storage_schemes `astor` ON
> astor.asset_store_id = as.asset_slice_store_scheme_id
>         WHERE a.asset_id = {bid}
>         ORDER BY asset_slice_row ASC""".format(bid = id))
>
> So I need that actual query to be executable via SQLAlchemy,
> preferably with SQLSoup. It doesn't work right now.
>

These errors suggest operating within a transaction where an error has
already occurred, and was swallowed. It's a general Python practice to
allow exceptions to propagate and be reported as a general failure at some
level where they are explicitly handled and at the very least logged.   If
you follow this procedure, and look for these errors occurring, you likely
won't have mysterious exceptions complaining about the invalid state of a
previous operation.   There is also no way for anyone to help if you do
not attach the full stack traces to your emails.

I would also challenge your assertion that SQLAlchemy is adding hours to
your development time - unless your application is extremely trivial, it
is saving you dozens versus using raw DBAPI.


--~--~---------~--~----~------------~-------~--~----~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to