Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #91063
| From | Lele Gaifax <lele@metapensiero.it> |
|---|---|
| Subject | Re: Camelot a good tool for me |
| Date | 2015-05-22 21:12 +0200 |
| Organization | Nautilus Entertainments |
| References | (1 earlier) <mjn804$4pe$1@dont-email.me> <87siaopxjs.fsf@Equus.decebal.nl> <201505221357.t4MDvgIV001904@fido.openend.se> <87k2w0le41.fsf@nautilus.nautilus> <CAPTjJmpnYwhOWdBz-=Zv8x+BO0G3e7OesPDvzd=nsX2a8Gsc-w@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.234.1432321974.17265.python-list@python.org> (permalink) |
Chris Angelico <rosuav@gmail.com> writes: > On Sat, May 23, 2015 at 3:24 AM, Lele Gaifax <lele@metapensiero.it> wrote: >> Laura Creighton <lac@openend.se> writes: >> >>> In my corner of the world, everybody uses SQL. >>> [...] >>> The people who have tried SQLAlchemy really didn't like it, and of course >>> the people who haven't tried it do what their friends do, as usual. >> >> If these sentences are related, you must live in a very strange corner! >> >> ;-) > Not sure why. I'm in the same corner, I think - I use SQL, and not > SQLAlchemy if I can help it. I'd much rather just use psycopg2 and do > my own queries. Didn't mean to be so serious, but anyway... > SQLAlchemy has its uses, and it does solve a number of > issues in reasonably clean ways, but I don't like a few of its facets, > including its peculiar way of doing foreign key relationships. (You > put a foreign key in the child, and you put a relationship in the > parent, which feels backwards.) You are conflating two different layers, core and ORM. ORM relationships can be declared either on the parent or on the child, it's up to your taste. > There's a lot of magic going on. Not in my experience, but I started using it long ago, so I'm biased. > When magic works, it's great; but when anything goes wrong, it's harder to > see what happened. The same can be said of almost any upper layer in a software stack. > Also, when does a transaction begin and end? When I need transactions (that is, when I'm changing the database) I'm very picky and use explicit begins, commits and rollbacks, so I don't recall experiencing that doubt. > If you session.commit() in the middle of iterating over a query, will it > break the query? What if you roll back? Can you see, instantly, in your > code? Why would you do that? Are you closing your files while you iterate them, without leaving the loop in some way at the same time? > Even if the ORM layer is practically perfect in every way, > there's still value in learning SQL; for instance, if you drop to a > command-line interpreter like PostgreSQL's psql, or if you switch to > another language, or anything like that, it's helpful to know what's > going on under the covers. And if you have to know SQL anyway, the > advantage of the abstraction layer has to justify the cost of learning > an additional, not a replacement, API. No doubt on that. Working with SQLAlchemy is not an alterative to knowing SQL fairly well. SA does hide "details" (name quoting syntax, to mention one obvious detail), but does not even try to hide the fact that it's talking SQL all the way down. I often have to deal with multiple DB engines at the same time, and being able to "write" my queries with an abstract syntax is very valuable for me. > So, while SQLAlchemy is definitely a lot better than most I've seen, > it's still not really good enough for me to use everywhere. I'm mostly > going to stick to the Python DB API 2.0. Again, I fully agree: one should work with whatever tool he feels comfortable with! ciao, lele. -- nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia. lele@metapensiero.it | -- Fortunato Depero, 1929.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Camelot a good tool for me Cecil Westerhof <Cecil@decebal.nl> - 2015-05-22 09:59 +0200
Re: Camelot a good tool for me Dan Sommers <dan@tombstonezero.net> - 2015-05-22 12:38 +0000
Re: Camelot a good tool for me Ben Finney <ben+python@benfinney.id.au> - 2015-05-22 23:02 +1000
Re: Camelot a good tool for me Cecil Westerhof <Cecil@decebal.nl> - 2015-05-22 15:11 +0200
Re: Camelot a good tool for me Tim Golden <mail@timgolden.me.uk> - 2015-05-22 14:29 +0100
Re: Camelot a good tool for me Laura Creighton <lac@openend.se> - 2015-05-22 15:57 +0200
Re: Camelot a good tool for me Lele Gaifax <lele@metapensiero.it> - 2015-05-22 19:24 +0200
Re: Camelot a good tool for me Chris Angelico <rosuav@gmail.com> - 2015-05-23 03:37 +1000
Re: Camelot a good tool for me Laura Creighton <lac@openend.se> - 2015-05-22 19:56 +0200
Re: Camelot a good tool for me Lele Gaifax <lele@metapensiero.it> - 2015-05-22 21:12 +0200
Re: Camelot a good tool for me Chris Angelico <rosuav@gmail.com> - 2015-05-23 18:59 +1000
Re: Camelot a good tool for me Lele Gaifax <lele@metapensiero.it> - 2015-05-24 15:15 +0200
Re: Camelot a good tool for me Laura Creighton <lac@openend.se> - 2015-05-22 15:03 +0200
Re: Camelot a good tool for me OT beauty of Tk Christian Gollwitzer <auriocus@gmx.de> - 2015-05-22 21:52 +0200
Re: Camelot a good tool for me OT beauty of Tk Laura Creighton <lac@openend.se> - 2015-05-22 22:13 +0200
Re: Camelot a good tool for me Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-05-22 15:24 +0100
Re: Camelot a good tool for me felix <felix@epepm.cupet.cu> - 2015-05-22 10:50 -0400
Re: Camelot a good tool for me Tim Chase <python.list@tim.thechases.com> - 2015-05-24 07:05 -0500
csiph-web