SQLAlchemy 0.3.2 released

10 views
Skip to first unread message

Michael Bayer

unread,
Dec 10, 2006, 12:55:36 PM12/10/06
to sqlal...@googlegroups.com
hey list -

I've released 0.3.2, on a slightly faster track than normal due to
the urgency of some of the fixes. If you're on the 0.3 series in any
production systems, this release should be mandatory.

Of the biggest importance is a connection pool fix where the "close
()" method on "ConnectionFairy" (a humorously ephemeral Proxy) that
returns its connection to the pool removes its own reference to the
connection when its completed (0.2 was fine with this, somehow it got
whacked in 0.3); otherwise, when its __del__ method is called it
tries to "close" again, issuing a second "rollback" on the
connection. when that connection is already at work in another
thread, well, you can figure out what can happen there.

Additionally, the users have spoken, and with their help I've tracked
down all kinds of little speed-related things that was chugging 0.3
to a halt. ORM performance should jump in all cases, and quite a bit
if you work extensively with backrefs.

Also in response to cries for appeasement is the return of the "one
page documentation". The link is on the docs page on the site as
well as in the docs that are with the release. I did it in a semi-
hurry and the navigation is a little sparse, but it seems people want
the one-pager mainly for printing (and searching?) so it will fulfill
that need. dont hammer it too much on the site since its enormous.

Finally, note that the "foreignkey" parameter on relation() is
deprecated. For self-referential mappers, use "remote_side" as a
drop-in replacement. For other needs, "foreignkey" is not going to
be fully functional (never was)...something better will be in a
future release.


full changelog:

0.3.2
- major connection pool bug fixed. fixes MySQL out of sync
errors, will also prevent transactions getting rolled back
accidentally in all DBs [ticket:387]
- major speed enhancements vs. 0.3.1, to bring speed
back to 0.2.8 levels
- made conditional dozens of debug log calls that were
time-intensive to generate log messages
- fixed bug in cascade rules whereby the entire object graph
could be unnecessarily cascaded on the save/update cascade
- various speedups in attributes module
- identity map in Session is by default *no longer weak referencing*.
to have it be weak referencing, use create_session
(weak_identity_map=True)
fixes [ticket:388]
- MySQL detects errors 2006 (server has gone away) and 2014
(commands out of sync) and invalidates the connection on which it
occured.
- MySQL bool type fix: [ticket:307]
- postgres reflection fixes: [ticket:349] [ticket:382]
- added keywords for EXCEPT, INTERSECT, EXCEPT ALL, INTERSECT ALL
[ticket:247]
- assign_mapper in assignmapper extension returns the created mapper
[changeset:2110]
- added label() function to Select class, when scalar=True is used
to create a scalar subquery
i.e. "select x, y, (select max(foo) from table) AS foomax from table"
- added onupdate and ondelete keyword arguments to ForeignKey; propigate
to underlying ForeignKeyConstraint if present. (dont propigate in the
other direction, however)
- fix to session.update() to preserve "dirty" status of incoming object
- sending a selectable to an IN via the in_() function no longer creates
a "union" out of multiple selects; only one selectable to a the in_()
function
is allowed now (make a union yourself if union is needed)
- improved support for disabling save-update cascade via
cascade="none" etc.
- added "remote_side" argument to relation(), used only with self-
referential
mappers to force the direction of the parent/child relationship.
replaces
the usage of the "foreignkey" parameter for "switching" the direction.
"foreignkey" argument is deprecated for all uses and will eventually
be replaced by an argument dedicated to ForeignKey specification on
mappers.

jose

unread,
Dec 11, 2006, 2:15:25 AM12/11/06
to sqlal...@googlegroups.com
Michael Bayer wrote:

>hey list -
>
>I've released 0.3.2, on a slightly faster track than normal due to
>the urgency of some of the fixes. If you're on the 0.3 series in any
>production systems, this release should be mandatory.
>
>Of the biggest importance is a connection pool fix where the "close
>()" method on "ConnectionFairy" (a humorously ephemeral Proxy) that
>returns its connection to the pool removes its own reference to the
>connection when its completed (0.2 was fine with this, somehow it got
>whacked in 0.3); otherwise, when its __del__ method is called it
>tries to "close" again, issuing a second "rollback" on the
>connection. when that connection is already at work in another
>thread, well, you can figure out what can happen there.
>
>Additionally, the users have spoken, and with their help I've tracked
>down all kinds of little speed-related things that was chugging 0.3
>to a halt. ORM performance should jump in all cases, and quite a bit
>if you work extensively with backrefs.
>
>Also in response to cries for appeasement is the return of the "one
>page documentation". The link is on the docs page on the site as
>well as in the docs that are with the release. I did it in a semi-
>hurry and the navigation is a little sparse, but it seems people want
>the one-pager mainly for printing (and searching?) so it will fulfill
>that need.
>

Thank you, Michael for this...
This is really useful to searching, and it would be very interesting
having this documentation in a pdf format to printing it in a easy way.
:-)

jo

Michael Bayer

unread,
Dec 11, 2006, 12:19:23 PM12/11/06
to sqlalchemy
yeah, still waiting for someone to show me some easy non-commercial
library that can create a decent PDF out of either markdown, or HTML,
or whatever...

Rick Morrison

unread,
Dec 11, 2006, 12:41:10 PM12/11/06
to sqlal...@googlegroups.com
We use (or rather, are going to use) reportlab for that - of course, that's commercial.

But, we did get a lot of mileage out of the programmatic open-source kit before that.

There was an RML-like thing floating around not too long ago called "tinyreport" or "openreport" or something like that....never looked at it in-depth as we needed things like PageCatcher, and I haven't seen anything in Python that could do something like that, although I think there are some Java tools that might.

FWIW, the Reportlab guys have been great to work with.

Rick

skip.mo...@gmail.com

unread,
Dec 11, 2006, 3:54:30 PM12/11/06
to sqlal...@googlegroups.com

Mike> yeah, still waiting for someone to show me some easy
Mike> non-commercial library that can create a decent PDF out of either
Mike> markdown, or HTML, or whatever...

Why not load the HTML into a web browser, print it, but select "Save as PDF"
instead of completing the print? Are there distribution restrictions on
such output?

Skip

Robin Munn

unread,
Dec 11, 2006, 4:50:17 PM12/11/06
to sqlal...@googlegroups.com

Do you know a way to do that programmatically? Otherwise it would add
quite a bit of work to the usual docs release process, which Michael
has automated pretty successfully so far.

And even if there was a way to do that programmatically, it still
wouldn't look as good as the PDF output of a script specifically
designed to format Markdown (or HTML or whatever) into PDF.

--
Robin Munn
Robin...@gmail.com
GPG key 0x4543D577

Lee McFadden

unread,
Dec 11, 2006, 5:05:41 PM12/11/06
to sqlal...@googlegroups.com
On 12/11/06, Robin Munn <robin...@gmail.com> wrote:
>
> On 12/11/06, skip.mo...@gmail.com <skip.mo...@gmail.com> wrote:
> >
> > Mike> yeah, still waiting for someone to show me some easy
> > Mike> non-commercial library that can create a decent PDF out of either
> > Mike> markdown, or HTML, or whatever...
> >

I was looking for something similar a while ago and found Pandoc[1].
I've not actually used it though as the client decided not to use
Markdown syntax. It has a command line script called markdown2pdf
which might help.

[1]: http://sophos.berkeley.edu/macfarlane/pandoc/README.html


--
Lee McFadden

blog: http://www.splee.co.uk
work: http://fireflisystems.com
skype: fireflisystems

David Geller

unread,
Dec 11, 2006, 6:07:39 PM12/11/06
to sqlal...@googlegroups.com
Mike,

1. How is the html documentation generated currently? You mentioned
"markdown", but what about "rst"? If all the docs were put into rst (as
an intermediate format), then theortically, it would be "easy" to
translate to html, Latex or pdf.

2. From what I know about reportlab, there *is* an opensource pdf
toolkit available under a bsd license (although I have never used it)

The key is having a netural, easily-parsable, flexible intermediate
format - like rst.

- David

Michael Bayer

unread,
Dec 11, 2006, 6:08:54 PM12/11/06
to sqlalchemy
well id want the paging to line up correctly, get the TOC in there,
stuff like that. otherwise theres not much advantage to PDF.

Arnar Birgisson

unread,
Dec 12, 2006, 5:28:45 AM12/12/06
to sqlal...@googlegroups.com
On 12/11/06, David Geller <dge...@gmail.com> wrote:
> 2. From what I know about reportlab, there *is* an opensource pdf
> toolkit available under a bsd license (although I have never used it)

There is, and it works well, although I haven't used it extensively.
It has advanced features for text layout and pagination. However it's
still low level compared to markdown->html converters and one has to
spend some time writing a program to generate a document.

It allows you to create bookmarks/toc, hyperlinks and all that fancy
PDF stuff.. :o)

And yes, this is all in the BSD licensed version.

Arnar

jose

unread,
Dec 12, 2006, 7:08:16 AM12/12/06
to sqlal...@googlegroups.com
Arnar Birgisson wrote:

I'm using htmldoc....
http://www.easysw.com/htmldoc/pdf-o-matic.php

j

jose

unread,
Dec 12, 2006, 10:47:21 AM12/12/06
to sqlal...@googlegroups.com
Hi all,

I'm writting a query with CASE, CAST, COALESCE...
Is there any possibility to express this using table object or class mapped?
------------------

SELECT bolletta.numero as nr_doc, bolletta.data_emissione as data_doc,
anagrafica.nome as rag_sociale,
comune.nome as comune, anagrafica.dato_fiscale as p_iva,
CASE WHEN
tariffa.aliquota_iva = 0
THEN
importo
ELSE
0.00
END as fuori_campo,

CASE WHEN
tariffa.aliquota_iva > 0
THEN
importo
ELSE
0.00
END as imponibile,
cast(importo*tariffa.aliquota_iva/100 as decimal(10,2)) as iva,
cast(importo+coalesce(bolletta.imposta_bollo,0)+(importo*tariffa.aliquota_iva/100)
as decimal(10,2)) as totale,
aa_bolletta_na||'/'||nr_bolletta_na as rif_na,
imposta_bollo,bolletta.sezionale
FROM bolletta, comune, anagrafica, figura_aziendale, bolletta_dettaglio,
tariffa
WHERE figura_aziendale.id_anagrafica = anagrafica.id
AND anagrafica.id_comune = comune.id
AND bolletta.cliente = figura_aziendale.id
AND bolletta_dettaglio.cod_tariffa = tariffa.codice
AND bolletta_dettaglio.aa_bolletta = bolletta.anno
AND bolletta_dettaglio.nr_bolletta = bolletta.numero
-----------

jo

Michael Bayer

unread,
Dec 12, 2006, 12:59:54 PM12/12/06
to sqlalchemy
we have case():

select(case([(table.c.x==5, 5), (table.c.y==7, 12)], else_=7))

and cast():

select([cast(table.c.x, Numeric)])

which are in the generated documentation for sql.py.

for coalesce() you can call that as func.coalesce() for now.

Jose Soares

unread,
Dec 13, 2006, 12:22:10 PM12/13/06
to sqlal...@googlegroups.com
Great!

jo


Michael Bayer ha scritto:

Reply all
Reply to author
Forward
0 new messages