Live data from Hacker News

Show HN: PRQL 0.2 – a better SQL

github.com

141–150 of 166 posts

Re: Show HN: PRQL 0.2 – a better SQL

#141

This reads a lot like the style of Pandas I teach.[0] This seems to have resolved a problem with SQL, you can't read it in a linear fashion. When we start getting query optimizers for Pandas, much of the benefit of SQL will go away. [0] https://store.metasnake.com/effective-pandas-book

What is a query optimizer for Pandas?

Re: Show HN: PRQL 0.2 – a better SQL

#142
I find SQL harder to work with because I'm used to reading and writing functions - functions that have explicit parameters with (hopefully) explicit types, and explicit return types.

So I was hoping PRQL might have some sugar like that.

It'd be nicer for my brain if I could treat any select like a function that transforms a set. Instead, even with PRQL, I'm stuck examining source tables and fully understanding them before being able to understand the query.

Re: Show HN: PRQL 0.2 – a better SQL

#144

I find SQL harder to work with because I'm used to reading and writing functions - functions that have explicit parameters with (hopefully) explicit types, and explicit return types. So I was hoping PRQL might have some sugar like that. It'd be nicer for my brain if I could treat any select like a function that transforms a set. Instead, even with PRQL, I'm stuck examining source tables and fully understanding them b…

Is this like what ORM for?

Re: Show HN: PRQL 0.2 – a better SQL

#145
post #37

I'm surprised that none of the examples on Github or the website deals with join. I eventually found some in the "book" here: https://prql-lang.org/book/transforms/join.html from employees join side:left positions [id==employee_id] turns into SELECT employees.*, positions.* FROM employees LEFT JOIN positions ON id = employee_id I would love to see joins worked into the main learning examples. Without join, the exampl…

Great point, we'll add that. I don't think we do joins that much better than SQL does. We're thinking whether there's potential there, maybe through understanding foreign keys — but we're being conservative about introducing change without value.

The biggest failure of SQL joins is not using declared foreign keys. For example it should be something like "JOIN USING fk_invoice_customer c" instead of repeating each time the relationship between invoice and customer entries already defined in foreign key

Re: Show HN: PRQL 0.2 – a better SQL

#146

Earlier quoted context omitted.

Great point, we'll add that. I don't think we do joins that much better than SQL does. We're thinking whether there's potential there, maybe through understanding foreign keys — but we're being conservative about introducing change without value.

The biggest failure of SQL joins is not using declared foreign keys. For example it should be something like "JOIN USING fk_invoice_customer c" instead of repeating each time the relationship between invoice and customer entries already defined in foreign key

Most engines support NATURAL JOIN, which isn't perfect and has drawbacks, but allows for shorter joins.

Re: Show HN: PRQL 0.2 – a better SQL

#148

Earlier quoted context omitted.

Great point, we'll add that. I don't think we do joins that much better than SQL does. We're thinking whether there's potential there, maybe through understanding foreign keys — but we're being conservative about introducing change without value.

The biggest failure of SQL joins is not using declared foreign keys. For example it should be something like "JOIN USING fk_invoice_customer c" instead of repeating each time the relationship between invoice and customer entries already defined in foreign key

[deleted]

Re: Show HN: PRQL 0.2 – a better SQL

#149

I've thought about building a better query language too. I'd love the ability to model sum types in databases, something like: enum SchoolType { College { degrees: Vec }, HighSchool } It's such a common pattern and yet it's so annoying to model in a normal relational database. I wouldn't be surprised if the rise of NoSQL is tied to the inability of relational databases to model basic patterns like this. Part of me ha…

IMHO categorical data model (https://www.categoricaldata.net/) has much better support for sum types than relational model (as well as other advantages, roughly along the lines why to prefer type theory to set theory in math foundations), unfortunately practical databases and query languages are not yet well developed for it.

Re: Show HN: PRQL 0.2 – a better SQL

#150

I've thought about building a better query language too. I'd love the ability to model sum types in databases, something like: enum SchoolType { College { degrees: Vec }, HighSchool } It's such a common pattern and yet it's so annoying to model in a normal relational database. I wouldn't be surprised if the rise of NoSQL is tied to the inability of relational databases to model basic patterns like this. Part of me ha…

Doesn’t Postgres support this with table inheritance https://www.postgresql.org/docs/current/tutorial-inheritance... I don’t know if they’re recommended, but they are an option.

They're not recommended: https://wiki.postgresql.org/wiki/Don%27t_Do_This#Don.27t_use....

They're incomplete (e.g. don't work with foreign keys) and are essentially unmaintained.

Post reply on HN