<div dir="ltr"><div>Héllo,<br><br><br>2014-05-13 1:34 GMT+02:00 flebber <<a href="mailto:flebber.crue@gmail.com">flebber.crue@gmail.com</a>>:<br>> If I want to use SQLAlchemy as my ORM what would be the best option for a web framework?<br>

<br>I think the best option would be Pyramid but I don't know SQLAchemy or Pyramid that much, but:<br><br>- Django doesn't support SQLAlchemy as is<br>- I don't recommend Flask, even if it has some «good intentions» (Jinja2 >> Django Template, Web Browser Debugger)<br>

- I don't know web.py, turbogears<br>- I only know that tornado is an async framework and <b>it seems to me </b>that Python+Async is still not mainstream<br></div>- This year, I was working on non-web related stuff, so I'm not fully up to date.<br>

<br><div><div><div><div>> 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.<br><br></div><div>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...<br>

</div><div><br>> 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?<br><br></div><div>
Like I said, I don't recommend flask and I know nobody using turbogears for new projects.<br>
</div><div><br>> 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.<br><br></div><div>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...)<br>

<br>> 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.<br>

<br></div><div>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.<br>

<br></div><div>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.<br>

</div><div><br>> Do I have a false fear of flask and doing bigger projects?<br><br></div><div>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 <a href="https://github.com/mozilla">mozilla@github</a>.<br>

</div><div><br>> So at this point I know I want SQLAlchemy, will use postgres(although mysql/maria would work fine).<br><br></div><div>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.<br>

<br></div><div>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.<br>

</div><div><br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><div class="im">flebber <<a href="mailto:flebber.crue@gmail.com">flebber.crue@gmail.com</a>> writes:<br>


<br>
> One of the main parts that is tripping myself up is that I need to<br>
> consistently import <span class="">xml</span> files into my database.<br>
<br>
</div><span class="">XML</span> documents represent a hierarchical tree of data. Relational<br>
databases are not good at representing hierarchical documents.<br></blockquote><br></div><div>- It's not always hierarchical data. <br></div><div>- RDBMS can handle hierarchical data anyway especially PostgresSQL<br>

<br></div><div>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:<br><br></div><div>- Frontend: main website, mainly for reading digital articles or articles from paper version. There is several frontends for the same backend.<br>

</div><div>- Backend: forms and whatnot for journalist to manage the content of the website<br></div><div>- Automatic processing: this needs little human interventions but are still fully part of the CMS<br><br></div><div>

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 <a href="https://github.com/liberation/django-swallow">django-swallow</a>.<br>

<br></div><div>This can do simple thing like: an XML file -> Python class -> a RDBMS row. <br><br>Or more complex stuff like:<br><br></div><div>- blacklist or whitelist input documents<br></div><div>- create several Python class (model instances)<br>

- update row if it already exists<br><br></div><div>And probably other stuffs, I think it is kind of documented.<br></div><div><br>It's not perfect, but was good enough to be put into production. For instance, <a href="http://journal.liberation.fr/publication/liberation/1554/#!/0_0">the  online reader</a> 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 ;)<br>

</div><div><br></div><div>One thing it was missing, is integration with Django forms for input and "output" (before saving in the database) validation.<br></div><div><br></div><div>It has a sibling package: <a href="https://github.com/liberation/django-carrier-pigeon">django-carrier-pigeon</a> which is dedicated to create "export rules".<br>

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

<br></div><div>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...<br>

</div><div><br></div><div>I can't help talking about graph databases, check them out if you have time :)<br></div><div><br>> Any pratical advice warmly welcomed, I think I am thining too much aimlessly maybe.<br><br>

</div><div>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*.<br>

<br></div><div>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...<br>

<br></div><div>(free) links regarding Django in particular:<br><br>- <a href="https://www.djangopackages.com/">https://www.djangopackages.com/</a><br>- <a href="http://lincolnloop.com/django-best-practices/">http://lincolnloop.com/django-best-practices/</a><br>

- <a href="http://roundup.lincolnloop.com/">http://roundup.lincolnloop.com/</a><br>- <a href="http://pyvideo.org/search?models=videos.video&q=Django">http://pyvideo.org/search?models=videos.video&q=Django</a><br>
</div>
<div><br></div><div>Happy python-ing!<br></div></div></div></div></div>