Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #38300

Re: Thoughts on SQL vs ORM

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <alec.taylor6@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.012
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'essentially': 0.04; 'frameworks': 0.05; 'repository': 0.05; 'welcome.': 0.07; 'python': 0.09; 'abstraction': 0.09; "django's": 0.09; 'etc).': 0.09; 'orm': 0.09; 'cc:addr:python-list': 0.10; 'language': 0.14; 'file,': 0.15; 'backends': 0.16; 'subject:ORM': 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'feb': 0.19; 'are:': 0.20; 'thanks.': 0.21; 'url:02': 0.22; 'cc:2**0': 0.23; 'specifically': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'question': 0.27; 'thoughts': 0.27; 'message-id:@mail.gmail.com': 0.27; 'concise': 0.29; 'measure': 0.29; 'project:': 0.29; 'url:mailman': 0.29; 'source': 0.29; 'query': 0.30; 'code': 0.31; 'url:python': 0.32; 'url:listinfo': 0.32; 'comments': 0.33; 'another': 0.33; 'agree': 0.34; 'received:google.com': 0.34; 'especially': 0.35; 'pm,': 0.35; 'sometimes': 0.35; 'next': 0.35; 'url:org': 0.36; 'generation': 0.36; 'useful': 0.36; 'why': 0.37; 'rather': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'url:mail': 0.40; 'your': 0.60; 'valuable': 0.60; 'easy': 0.60; 'most': 0.61; 'personally': 0.61; 'between': 0.63; 'different': 0.63; 'more': 0.63; 'url:blogspot': 0.64; 'here': 0.65; 'of:': 0.65; 'due': 0.66; 'advantages': 0.71; '2013': 0.84; 'complexity': 0.84; 'subject:SQL': 0.84; 'to:addr:live.com': 0.84; 'url:2013': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:content-transfer-encoding; bh=Kntsspq1EDFTKBGaPEb4HJNLDCneReJkJLqO5uL83vo=; b=h5XBBUN+cVX68yVwjNhoICv/dNQx/nAFny9LC381RgAtVjCoyOCysh2PQqWAaCu3hk Wp65DcRJYEO4K7KBHYeOA+D1Ja8GztO+EIRkXzGP/cVujWhn7GeUKdZHccLJv+5ygxnc AnaZIvAUwxzDWn3UKKm6F9WzVj40yeE77yn/sI+GVnkD+h/HqMYLTIGZ6CIi2L16Kype RMmLIt0/6jNz53tgSRQRVQa8WGr4njA8hxedOWf3PlfXIWZQ41S45OEf/PPc+cuYYV3n LToBz0/FoesLi7vaS+5+NIPEkF3bRl1+VJTJhgIJF/DuLPj5wHHnRw287/wT5wBlg2Nn 6YGQ==
MIME-Version 1.0
X-Received by 10.50.161.135 with SMTP id xs7mr8300518igb.3.1360174520780; Wed, 06 Feb 2013 10:15:20 -0800 (PST)
In-Reply-To <DUB117-W19810D8772C6334E9935AE91070@phx.gbl>
References <DUB117-W19810D8772C6334E9935AE91070@phx.gbl>
Date Thu, 7 Feb 2013 05:15:20 +1100
Subject Re: Thoughts on SQL vs ORM
From Alec Taylor <alec.taylor6@gmail.com>
To Andriy Kornatskyy <andriy.kornatskyy@live.com>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
Cc "python-list@python.org" <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1424.1360174530.2939.python-list@python.org> (permalink)
Lines 44
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1360174530 news.xs4all.nl 6859 [2001:888:2000:d::a6]:51076
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:38300

Show key headers only | View raw


I agree that ORMs can be rather complicated; especially when you need
to do some refactoring.

Another reason not to use ORMs is difficult of measuring query complexity.

However, some of the most major advantages of ORMs are:
- Generation of forms
- Same code can be used with multiple backends
- The different data abstraction can sometimes be useful

Personally for my projects I don't use an ORM. I use a DAL: Database
Abstraction Layer, specifically the one from web2py (usable with a
variety of competing frameworks including Flask).

This has the advantages of:
- Generation of forms
- Same code can be used with multiple backends
- More concise query construction, using Python language concepts
- Extremely easy to measure query complexity and amount of data that
will be manipulated (compare this to Django's ORM; which essentially
requires use of DDT)

Just my 2ยข

On Wed, Feb 6, 2013 at 11:58 PM, Andriy Kornatskyy
<andriy.kornatskyy@live.com> wrote:
>
> The question of persistence implementation arise often. I found repository pattern very valuable due to separation of concerns, mediate between domain model and data source (mock, file, database, web service, etc).
>
> The database data source is somewhat specific since you can proceed with SQL functions or ORM. Here are some thoughts why you might prefer SQL functions over ORM in your next project:
>
> http://mindref.blogspot.com/2013/02/sql-vs-orm.html
>
> Comments or suggestions are welcome.
>
> Thanks.
>
> Andriy Kornatskyy
> --
> http://mail.python.org/mailman/listinfo/python-list

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Thoughts on SQL vs ORM Alec Taylor <alec.taylor6@gmail.com> - 2013-02-07 05:15 +1100

csiph-web