Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'api.': 0.04; 'sql.': 0.07; 'api': 0.09; 'abstraction': 0.09; 'creighton': 0.09; 'orm': 0.09; 'seen,': 0.09; 'sql,': 0.09; 'wrong,': 0.09; 'cc:addr:python- list': 0.10; 'python': 0.11; 'language,': 0.11; 'do,': 0.15; 'interpreter': 0.15; '23,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'iterating': 0.16; 'magic': 0.16; 'query,': 0.16; 'sqlalchemy': 0.16; 'uses,': 0.16; 'usual.': 0.16; 'wrote:': 0.16; 'instance,': 0.18; 'laura': 0.18; 'why.': 0.18; ';-)': 0.18; 'cc:2**0': 0.21; 'cc:addr:python.org': 0.21; 'stick': 0.22; 'am,': 0.23; '2015': 0.23; '(you': 0.23; 'sat,': 0.23; "haven't": 0.24; "i've": 0.24; 'tried': 0.24; 'header:In- Reply-To:1': 0.24; 'helpful': 0.27; 'mostly': 0.27; 'switch': 0.27; 'see,': 0.27; 'message-id:@mail.gmail.com': 0.28; "i'm": 0.29; 'command-line': 0.29; "i'd": 0.31; 'another': 0.34; 'transaction': 0.34; 'received:google.com': 0.34; 'that,': 0.34; 'drop': 0.35; 'really': 0.35; 'but': 0.36; 'so,': 0.37; "didn't": 0.37; 'subject:: ': 0.37; 'world,': 0.38; 'rather': 0.38; 'doing': 0.38; 'goes': 0.39; 'does': 0.39; 'enough': 0.39; 'sure': 0.40; 'your': 0.60; 'even': 0.61; 'relationship': 0.61; 'strange': 0.63; 'course': 0.64; 'everybody': 0.67; 'foreign': 0.69; 'friends': 0.82; '(also,': 0.84; 'back?': 0.84; 'child,': 0.84; 'chrisa': 0.84; 'everywhere.': 0.84; 'happened.': 0.84; 'subject:good': 0.84; 'subject:tool': 0.84; 'to:none': 0.90 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=FFTCM8wbUFUN/Txws4nUR73dqCGR+OaYAIUQ4TTxSv4=; b=06FN5FOYbv9whbq7/cmAzrcU6hjc7EKnNsKY7kZbMnUR88w3Am76R2XiYujBkPFXzc /OpIgZMT+WPRFHP/Wc1AlVokQkTrPlm6RXO0ozziwQZQHGMYo1SaP6UUbh2LnhZAqd9d jINXV96wIab0PaCyY/M6wNk58hTCkJEhs8qdVv81t134NCz3Q2yn5oei19NT/WspmEhX 1FoiJSBBBOgutEz+I58gG9rkUthKx3IeRLLbrQnjR4cX6JpHQlzTjCdFofF9E+l9ed6a RPFxVRu+xmxxcku8FwqbXm7SZZGI3Ygre70aQi8qFOvVnNaHGsCntagAD9JbZFAz6Lcx D66Q== MIME-Version: 1.0 X-Received: by 10.50.176.228 with SMTP id cl4mr7225275igc.2.1432316223274; Fri, 22 May 2015 10:37:03 -0700 (PDT) In-Reply-To: <87k2w0le41.fsf@nautilus.nautilus> References: <87zj4xoxfd.fsf@Equus.decebal.nl> <87siaopxjs.fsf@Equus.decebal.nl> <201505221357.t4MDvgIV001904@fido.openend.se> <87k2w0le41.fsf@nautilus.nautilus> Date: Sat, 23 May 2015 03:37:03 +1000 Subject: Re: Camelot a good tool for me From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 36 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1432316225 news.xs4all.nl 2888 [2001:888:2000:d::a6]:54115 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:91055 On Sat, May 23, 2015 at 3:24 AM, Lele Gaifax wrote: > Laura Creighton 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. 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.) There's a lot of magic going on. When magic works, it's great; but when anything goes wrong, it's harder to see what happened. (Also, when does a transaction begin and end? 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?) 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. 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. ChrisA