top | item 10165573

Porting Flask to Go – Jinja2 to Pongo2

40 points| eatonphil | 10 years ago |blog.thinkful.me | reply

37 comments

order
[+] Goranek|10 years ago|reply
Last 2 years I've been using Go (instead of Python), even for webpages & apis. I'm actually considering going back to Python(for webpages and apis) because dealing with database in Go is really ugly. Currently available orms are nowhere near as useful as sqlAlchemy or django orm :(
[+] bsaul|10 years ago|reply
Glad to hear i'm not alone in that case. I actually think someone should blog about this, because i've got the suspicion that the "moving to go is fantastic" feeling we get from blog posts suffers from a survivorship bias.
[+] alberth|10 years ago|reply
ORMs?

Am I alone when I say that I still hand code SQL into my applications?

Regardless of what web framework I'm using (e.g. Pylons/Rails/Django/etc), I still hand code SQL statement in my applications.

I've had far to many times ORMs unexpectedly nuke performance and have other issues than what's it's worth gaining by using an ORM.

[+] sauere|10 years ago|reply
Word! Flask and the flask-sqlalchemy extension are a dreamteam that i wouldn't want to miss anymore. Golang might perform 10x better, but i'd choose the faster development cycle and comfort of Flask at any given day.
[+] mrweasel|10 years ago|reply
It might be the problems I solve, or the way I think about them, but I think it's about 50/50 whether the ORM is helpful or in the way. Very often I just want the ORM to go away because I know what I'm doing and the ORM doesn't

I do like sqlx, it seems to hit a balance that works for me. I get to write the SQL and structs come out.

[+] lbotos|10 years ago|reply
Have you considered Elixir? I'm a mostly Python guy that was intrigued by Go for web but am now exploring Elixir.
[+] tapirl|10 years ago|reply
Since I gave up SQL databases by using NoSQL ones, ORM is not needed any more.

You know, I always feel ORM is a fix to SQL.

[+] misiti3780|10 years ago|reply
i recently starting experimenting with moving from python to go and for fun (for web development) and was surprised at the current available options for ORMs. even established frameworks like Revel seem like they are suggesting using raw sql queries still:

https://revel.github.io/manual/database.html

this is golang's Django i believe ?

[+] zem|10 years ago|reply
same reason i gave up on the idea of using ocaml for crud apps, even though i love it for most other applications. it's really annoying to have to manually manipulate database rows via raw lists of strings :(
[+] grey-area|10 years ago|reply
Out of curiosity, what did you most miss from those orms?
[+] Scarbutt|10 years ago|reply
and no authentication/authorization library.
[+] davexunit|10 years ago|reply
String-based templating is a bad pattern fraught with security issues that shouldn't be translated from old languages to new ones.
[+] jamespo|10 years ago|reply
I'm interested to hear an alternative, particularly one that will work with separate front end dev teams etc.
[+] fidget|10 years ago|reply
Oh thank god. Go is bearable in most areas, but the template system makes me weep. Is there any particular reason the string concatenation doesn't work? Seems special enough to be specialcased ;)
[+] tapirl|10 years ago|reply
You can use {{print .foo.bar "string"}} and {{printf "%sstring" .foo.bar}} to concat strings in golang template, or even simpler way: {{.foo.bar}}{{"string"}}.