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


Groups > comp.lang.python > #71405 > unrolled thread

SQLAlchemy - web framework ?

Started byflebber <flebber.crue@gmail.com>
First post2014-05-12 16:34 -0700
Last post2014-05-23 14:48 +0200
Articles 10 — 6 participants

Back to article view | Back to comp.lang.python


Contents

  SQLAlchemy - web framework ? flebber <flebber.crue@gmail.com> - 2014-05-12 16:34 -0700
    Re: SQLAlchemy - web framework ? Iuri <iurisilvio@gmail.com> - 2014-05-12 21:44 -0300
    Re: SQLAlchemy - web framework ? Ben Finney <ben@benfinney.id.au> - 2014-05-13 10:55 +1000
    Re: SQLAlchemy - web framework ? Roy Smith <roy@panix.com> - 2014-05-12 21:04 -0400
      Re: SQLAlchemy - web framework ? flebber <flebber.crue@gmail.com> - 2014-05-12 22:28 -0700
        Re: SQLAlchemy - web framework ? Roy Smith <roy@panix.com> - 2014-05-13 07:11 -0400
          Re: SQLAlchemy - web framework ? flebber <flebber.crue@gmail.com> - 2014-05-14 00:27 -0700
            Re: SQLAlchemy - web framework ? Ben Finney <ben@benfinney.id.au> - 2014-05-14 17:45 +1000
    Re: SQLAlchemy - web framework ? Sayth Renshaw <flebber.crue@gmail.com> - 2014-05-13 11:29 +1000
    Re: SQLAlchemy - web framework ? Amirouche Boubekki <amirouche.boubekki@gmail.com> - 2014-05-23 14:48 +0200

#71405 — SQLAlchemy - web framework ?

Fromflebber <flebber.crue@gmail.com>
Date2014-05-12 16:34 -0700
SubjectSQLAlchemy - web framework ?
Message-ID<17149f49-bb71-4c97-9d07-d80766b93865@googlegroups.com>
If I want to use SQLAlchemy as my ORM what would be the best option for a web framework?

It appears the general advice regarding Django is to do it the Django way and use the django ORM and change it out for SQLAlchemy.

That to me limited knowledge leaves flask, pyramid and turbogears 2. So if I wanted to not build it all myself as with flask then potentially pyramid, turbogears is the best option?

Is this true? I have completed the TG2 intro tutorial and have built several small things with flask although I feel offput by doing anything bigger in flask.

See what I have done is got my python knowledge to a fair point where I can do useful things, good knowledge of web HTML/CSS, built a few small projects in flask to get an idea for python web, completed django tutorials, turogears tutorials and now looking to design out a bigger project I want to set myself and i am trying to compile the parts so I can see what I will need to use and gather info to cover what othe things I will need to know.

Do I have a false fear of flask and doing bigger projects?

So at this point I know I want SQLAlchemy, will use postgres(although mysql/maria would work fine). 

Any pratical advice warmly welcomed, I think I am thining too much aimlessly maybe.

http://turbogears.org/
http://www.pylonsproject.org/
http://flask.pocoo.org/
https://www.djangoproject.com/
http://www.tornadoweb.org/en/stable/

[toc] | [next] | [standalone]


#71413

FromIuri <iurisilvio@gmail.com>
Date2014-05-12 21:44 -0300
Message-ID<mailman.9930.1399941876.18130.python-list@python.org>
In reply to#71405

[Multipart message — attachments visible in raw view] — view raw

I don't know what exactly you mean with "wanted to not build it all
myself", but Flask is great with SQLAlchemy. You have the Flask-SQLAlchemy
extension and it has a lot of other integrations, like Flask-Admin.

You don't have to fear flask to bigger projects. To be honest, I prefer it
instead of Django because I can grow the project the way I want, without
framework strings.




On Mon, May 12, 2014 at 8:34 PM, flebber <flebber.crue@gmail.com> wrote:

> If I want to use SQLAlchemy as my ORM what would be the best option for a
> web framework?
>
> It appears the general advice regarding Django is to do it the Django way
> and use the django ORM and change it out for SQLAlchemy.
>
> That to me limited knowledge leaves flask, pyramid and turbogears 2. So if
> I wanted to not build it all myself as with flask then potentially pyramid,
> turbogears is the best option?
>
> Is this true? I have completed the TG2 intro tutorial and have built
> several small things with flask although I feel offput by doing anything
> bigger in flask.
>
> See what I have done is got my python knowledge to a fair point where I
> can do useful things, good knowledge of web HTML/CSS, built a few small
> projects in flask to get an idea for python web, completed django
> tutorials, turogears tutorials and now looking to design out a bigger
> project I want to set myself and i am trying to compile the parts so I can
> see what I will need to use and gather info to cover what othe things I
> will need to know.
>
> Do I have a false fear of flask and doing bigger projects?
>
> So at this point I know I want SQLAlchemy, will use postgres(although
> mysql/maria would work fine).
>
> Any pratical advice warmly welcomed, I think I am thining too much
> aimlessly maybe.
>
> http://turbogears.org/
> http://www.pylonsproject.org/
> http://flask.pocoo.org/
> https://www.djangoproject.com/
> http://www.tornadoweb.org/en/stable/
> --
> https://mail.python.org/mailman/listinfo/python-list
>

[toc] | [prev] | [next] | [standalone]


#71414

FromBen Finney <ben@benfinney.id.au>
Date2014-05-13 10:55 +1000
Message-ID<mailman.9932.1399942524.18130.python-list@python.org>
In reply to#71405
flebber <flebber.crue@gmail.com> writes:

> If I want to use SQLAlchemy as my ORM what would be the best option
> for a web framework?
>
> It appears the general advice regarding Django is to do it the Django
> way and use the django ORM and change it out for SQLAlchemy.

You don't say any more about this. Have you evaluated this option? What
leads you to believe it is not satisfactory (as implied by the rest of
your message)?

-- 
 \     “We are no more free to believe whatever we want about God than |
  `\         we are free to adopt unjustified beliefs about science or |
_o__)              history […].” —Sam Harris, _The End of Faith_, 2004 |
Ben Finney

[toc] | [prev] | [next] | [standalone]


#71415

FromRoy Smith <roy@panix.com>
Date2014-05-12 21:04 -0400
Message-ID<roy-60A628.21042312052014@news.panix.com>
In reply to#71405
In article <17149f49-bb71-4c97-9d07-d80766b93865@googlegroups.com>,
 flebber <flebber.crue@gmail.com> wrote:

> If I want to use SQLAlchemy as my ORM what would be the best option for a web 
> framework?
> 
> It appears the general advice regarding Django is to do it the Django way and 
> use the django ORM and change it out for SQLAlchemy.

I'm not quite sure how to parse that last sentence.  In any case, if 
you're afraid of using a third-party ORM with django, don't worry about 
that.  We make extensive use of django and do not use the supplied ORM 
layer.  In our case, we couldn't, because we're using MongoDB (we use 
mongoengine as our ORM).  Django is modular enough that there's really 
no problem swapping the ORM out for another component.

[toc] | [prev] | [next] | [standalone]


#71426

Fromflebber <flebber.crue@gmail.com>
Date2014-05-12 22:28 -0700
Message-ID<d738b225-cf28-4114-a565-58a60919fe42@googlegroups.com>
In reply to#71415
Roy.that is interesting that you can use mongoengine. 

Recent google results such as seem to assert there are a lot of inherent risk in swapping out components, though I may be misinterpreting it. http://www.slideshare.net/daikeren/tradeoffs-of-replacing-core-components

Sayth 

[toc] | [prev] | [next] | [standalone]


#71468

FromRoy Smith <roy@panix.com>
Date2014-05-13 07:11 -0400
Message-ID<roy-EF4FFA.07112913052014@news.panix.com>
In reply to#71426
In article <d738b225-cf28-4114-a565-58a60919fe42@googlegroups.com>,
 flebber <flebber.crue@gmail.com> wrote:

> Roy.that is interesting that you can use mongoengine. 
> 
> Recent google results such as seem to assert there are a lot of inherent risk 
> in swapping out components, though I may be misinterpreting it. 
> http://www.slideshare.net/daikeren/tradeoffs-of-replacing-core-components

I wouldn't take every slideshow I find on the net as gospel.  There is 
risk in doing anything.  The only slide I find of much value in that 
deck is 22, but that's pretty much a requirement anyway.  Most of the 
rest is just fear mongering.

FWIW, we don't use any third-party packages, and we don't use the admin.  
If those things are important to you, then I agree, swapping out the ORM 
will be interesting.  Mostly what we use from django are the middleware 
framework (we write a lot of our own middleware), url parsing, and view 
dispatch.

[toc] | [prev] | [next] | [standalone]


#71537

Fromflebber <flebber.crue@gmail.com>
Date2014-05-14 00:27 -0700
Message-ID<718e12ee-8f6c-4d21-8e98-14355c154470@googlegroups.com>
In reply to#71468
One of the main parts that is tripping myself up is that I need to consistently import xml files into my database.

Looking to find the best support and methodologies to do this, that is one of the reasons I am looking at SqlAlchemy. 

Sayth 

[toc] | [prev] | [next] | [standalone]


#71538

FromBen Finney <ben@benfinney.id.au>
Date2014-05-14 17:45 +1000
Message-ID<mailman.9991.1400053529.18130.python-list@python.org>
In reply to#71537
flebber <flebber.crue@gmail.com> writes:

> One of the main parts that is tripping myself up is that I need to
> consistently import xml files into my database.

XML documents represent a hierarchical tree of data. Relational
databases are not good at representing hierarchical documents.

So I don't know what you mean by “consistently import xml files into my
database”. What are you expecting the result to be?

You won't have sensible relational records as a result. At best, you'll
have XML blobs in single SQL fields.

> Looking to find the best support and methodologies to do this, that is
> one of the reasons I am looking at SqlAlchemy.

I've asked you about using Django with SQLAlchemy; it's not clear why
you don't think that is suitable.

So I have the same question: What makes you think a database API is
going to solve the problem, and what makes you think SQLAlchemy in
particlar is the right solution?

More generally: You appear to have already decided what the solution is,
without making clear to us what the problem is. Advice is going to be
mis-matched until you tell us more about what problem you're trying to
solve.

-- 
 \             “The Way to see by Faith is to shut the Eye of Reason.” |
  `\                                                —Benjamin Franklin |
_o__)                                                                  |
Ben Finney

[toc] | [prev] | [next] | [standalone]


#71417

FromSayth Renshaw <flebber.crue@gmail.com>
Date2014-05-13 11:29 +1000
Message-ID<mailman.9933.1399944585.18130.python-list@python.org>
In reply to#71405

[Multipart message — attachments visible in raw view] — view raw

I am saying 'do it myself' in that with flask that provide a small base and
then all functionality is added by me directly, with the assistance of
community modules. Compared to Django whose developers have created an
integrated set of defaults with more functionality standard,  which is good
if you like the defaults.

Sayth
 On 13/05/2014 10:44 am, "Iuri" <iurisilvio@gmail.com> wrote:

> I don't know what exactly you mean with "wanted to not build it all
> myself", but Flask is great with SQLAlchemy. You have the Flask-SQLAlchemy
> extension and it has a lot of other integrations, like Flask-Admin.
>
> You don't have to fear flask to bigger projects. To be honest, I prefer it
> instead of Django because I can grow the project the way I want, without
> framework strings.
>
>
>
>
> On Mon, May 12, 2014 at 8:34 PM, flebber <flebber.crue@gmail.com> wrote:
>
>> If I want to use SQLAlchemy as my ORM what would be the best option for a
>> web framework?
>>
>> It appears the general advice regarding Django is to do it the Django way
>> and use the django ORM and change it out for SQLAlchemy.
>>
>> That to me limited knowledge leaves flask, pyramid and turbogears 2. So
>> if I wanted to not build it all myself as with flask then potentially
>> pyramid, turbogears is the best option?
>>
>> Is this true? I have completed the TG2 intro tutorial and have built
>> several small things with flask although I feel offput by doing anything
>> bigger in flask.
>>
>> See what I have done is got my python knowledge to a fair point where I
>> can do useful things, good knowledge of web HTML/CSS, built a few small
>> projects in flask to get an idea for python web, completed django
>> tutorials, turogears tutorials and now looking to design out a bigger
>> project I want to set myself and i am trying to compile the parts so I can
>> see what I will need to use and gather info to cover what othe things I
>> will need to know.
>>
>> Do I have a false fear of flask and doing bigger projects?
>>
>> So at this point I know I want SQLAlchemy, will use postgres(although
>> mysql/maria would work fine).
>>
>> Any pratical advice warmly welcomed, I think I am thining too much
>> aimlessly maybe.
>>
>> http://turbogears.org/
>> http://www.pylonsproject.org/
>> http://flask.pocoo.org/
>> https://www.djangoproject.com/
>> http://www.tornadoweb.org/en/stable/
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>>
>
>

[toc] | [prev] | [next] | [standalone]


#71926

FromAmirouche Boubekki <amirouche.boubekki@gmail.com>
Date2014-05-23 14:48 +0200
Message-ID<mailman.10243.1400849319.18130.python-list@python.org>
In reply to#71405

[Multipart message — attachments visible in raw view] — view raw

Héllo,


2014-05-13 1:34 GMT+02:00 flebber <flebber.crue@gmail.com>:
> If I want to use SQLAlchemy as my ORM what would be the best option for a
web framework?

I think the best option would be Pyramid but I don't know SQLAchemy or
Pyramid that much, but:

- Django doesn't support SQLAlchemy as is
- I don't recommend Flask, even if it has some «good intentions» (Jinja2 >>
Django Template, Web Browser Debugger)
- I don't know web.py, turbogears
- I only know that tornado is an async framework and *it seems to me *that
Python+Async is still not mainstream
- This year, I was working on non-web related stuff, so I'm not fully up to
date.

> It appears the general advice regarding Django is to do it the Django way
and use the django ORM and change it out for SQLAlchemy.

You will loose a lot of the benefits of using Django. My point of view is
that removing one thing in Django (even the template system) will lead me
to remove *a lot of things*... writing a new framework. Not necessarily
because they are coupled, but because there is kind of a lot of stuff I
dislike in Django... But I still use Django, trying to avoid land mines and
working around inefficiencies...

> That to me limited knowledge leaves flask, pyramid and turbogears 2. So
if I wanted to not build it all myself as with flask then potentially
pyramid, turbogears is the best option?

Like I said, I don't recommend flask and I know nobody using turbogears for
new projects.

> Is this true? I have completed the TG2 intro tutorial and have built
several small things with flask although I feel offput by doing anything
bigger in flask.

They are templates projects that help bootstrap bigger projects. But
anyway, last time I checked Flask has less resources (documentation,
example code, example project, coobooks, documented pratices...)

> See what I have done is got my python knowledge to a fair point where I
can do useful things, good knowledge of web HTML/CSS, built a few small
projects in flask to get an idea for python web, completed django
tutorials, turogears tutorials and now looking to design out a bigger
project I want to set myself and i am trying to compile the parts so I can
see what I will need to use and gather info to cover what othe things I
will need to know.

The thing that, again, goes in the direction of choosing Django, is that
it's a big noosphere == lot of ressources of different kind code, video,
articles, books == lot of people from different background and interests ==
lot of ideas. Getting to learn things is easier in this conditions.

If you choose another framework, you will invest extra time while referring
to documentation written for Django. Since you seem to be starting Python,
it will be easier to avoid this extra step of translation. Even if
«translation» is a very common pratice of programming, so working on that
skill is interesting.

> Do I have a false fear of flask and doing bigger projects?

Many people claim they use Flask on big projects, but AFAIK there is no big
open source projects written with Flask. So you can't be sure about what it
means to use Flask in big project anyway. Mozilla use extensively Django,
checkout mozilla@github <https://github.com/mozilla>.

> So at this point I know I want SQLAlchemy, will use postgres(although
mysql/maria would work fine).

SQLAlchemy is better than Django's equivalent. Like said I don't fully know
SQLAlchemy. But the SQL language mapping in Python is nicer in SQLAlchemy.
The project is dedicated to supporting RDBMS so there is better support,
tooling, I think.

Some people will say it's a matter of taste, look'n'feel and compare it to
"ice cream flavors". IMO it's not comparable to "ice cream flavor" but
different people have different needs, background and context so favor one
library instead of another without strong engineering or scientific
grounds. Money, business, HR & marketing will have more significance.

flebber <flebber.crue@gmail.com> writes:
>
> > One of the main parts that is tripping myself up is that I need to
> > consistently import xml files into my database.
>
> XML documents represent a hierarchical tree of data. Relational
> databases are not good at representing hierarchical documents.
>

- It's not always hierarchical data.
- RDBMS can handle hierarchical data anyway especially PostgresSQL

When I was at Libération (a french national newspaper, kind of the french
Guardian). We ported the previous CMS based on a custom PHP framework to
Django. Basically there was 3 parts:

- Frontend: main website, mainly for reading digital articles or articles
from paper version. There is several frontends for the same backend.
- Backend: forms and whatnot for journalist to manage the content of the
website
- Automatic processing: this needs little human interventions but are still
fully part of the CMS

The CMS import stuff, many kind among which articles bundled in XML. A
"django application", a python package integrated with django that creates
a mini-framework for implementing "import rules" called
django-swallow<https://github.com/liberation/django-swallow>
.

This can do simple thing like: an XML file -> Python class -> a RDBMS row.

Or more complex stuff like:

- blacklist or whitelist input documents
- create several Python class (model instances)
- update row if it already exists

And probably other stuffs, I think it is kind of documented.

It's not perfect, but was good enough to be put into production. For
instance, the online
reader<http://journal.liberation.fr/publication/liberation/1554/#!/0_0>content
was fully imported by a django-swallow based modules. It was the
most complex import. It's fully integrated (search & co). It was the main
objective of django-swallow: make it easy to import paper version of the
newspaper with minimal human needed to mess around ;)

One thing it was missing, is integration with Django forms for input and
"output" (before saving in the database) validation.

It has a sibling package:
django-carrier-pigeon<https://github.com/liberation/django-carrier-pigeon>which
is dedicated to create "export rules".

I don't know if those are the best apps today, but when they were created,
nothing matched. See https://www.djangopackages.com/search/?q=import

I discovered recently in a PHP project a RDBMS tree structure for menus, I
can recall the name right now. Basically, even if RDBMS is not good at
trees. You make it good at the particular query that requires performance
by duplicating informations... for instance a hierarchical menu is seldom
updated, but quiet often queried, so make it easy to query and but slow to
update...

I can't help talking about graph databases, check them out if you have time
:)

> Any pratical advice warmly welcomed, I think I am thining too much
aimlessly maybe.

Like I said, previously IMO Django is less than perfect. There is hope, I
read on the ML that Django 2 is coming ;) (with no ETA of course). Anyway,
especially for beginners it's the obvious choice. And I think that if you
are a newbie, it's always better to go for the obvious *first*.

At my new company, we are aiming to move to Python. I'm not confident
pushing something else than Django. Not only because it means "extra" work,
but also, even if I hate it, because of marketing...

(free) links regarding Django in particular:

- https://www.djangopackages.com/
- http://lincolnloop.com/django-best-practices/
- http://roundup.lincolnloop.com/
- http://pyvideo.org/search?models=videos.video&q=Django

Happy python-ing!

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web