Better HN
topnewbestaskshowjobs
Log inSign up

zwack

5 karma · joined Apr 27, 2014 (12y ago) · 6 submissions

Programming (and breathing!) motherf*cker.
Submissions

comment 6y ago · link · parent

In quma this would look like this (when using the default mako templating).

    example.sql

    SELECT 
        * 
    FROM
        %(table1)s
    JOIN
        %(table2)s
    WHERE
        column1 = "value"
        % if use_subset:
            AND column2=%(filter_value)s
        % endif


    def get_data(table1, table1, use_subset=True):
        if use_subset:
            filter_value = "subset_value"
        else:
            filter_query = ""

        data = cur.example(table1=table1,
                        table2=table2,
                        use_subset=use_subset,
                        filter_value=filter_value).all()
https://github.com/ebenefuenf/quma/ https://quma.readthedocs.io/en/latest/templates.html

comment 6y ago · link · parent

Co-Author here. We wanted to have full control over our db/sql and think it's also easier to read this way (instead of using an ORM). Similar libs got posted recently, quma will provide you with namespaces, supports dynamic SQL (conditional WHERE), has a connection pool and generally makes it nice to work with.

It's also battle tested, we're using quma since 2 years in production (pyramid app) with ~350 sql files and are quite happy.

Would be cool if someone plays around with it. Questions welcome.

comment 6y ago · link · parent

We wrote a similar lib and use namespaces: https://quma.readthedocs.io/en/latest/usage.html#running-que...

comment 6y ago · link · parent

You could have a look at our attempt, it allows dynamic SQL using templating.

https://github.com/ebenefuenf/quma

5.

Show HN: Quma – Plain SQL in Python(github.com ↗)

5 points · by zwack · 6y ago · 1 comment

comment 12y ago · link · parent

Product configurator built with AngularJS. Pretty complex ruleset for allowed combinations.

https://i.imgur.com/FfeWmt1.png