Live data from Hacker News

SQLite Release 3.25.0 adds support for window functions

sqlite.org

91–100 of 116 posts

Re: SQLite Release 3.25.0 adds support for window functions

#91

Earlier quoted context omitted.

This looks great, but I couldn't get through the first question on aggregate functions. Are there any SQL books/tutorials that go over things like this? A lot of material I've seen has been like the classic image of "How to draw an owl. First draw two circles, then draw the rest of the owl", where they tell you the super basic stuff, then assume you know everything.

(self plug) try pgexercises.com. It's in a very similar vein to windowfunctions - I understand it was one of the original inspirations - but it covers a much wider range of material, with a gradual growth from very basic stuff up to slightly advanced.

I'll vouch for this plug! I've spent quite a bit of time learning SQL (and Postgres specific stuff), and this was one of my favorite resources.

I can also recommend Learning SQL by Alan Beaulieu, which was recommended in some HN comment. After looking into various books, some of them Postgres specific, I found this one to be the best for learning from scratch.

Re: SQLite Release 3.25.0 adds support for window functions

#92
post #87

A bit off topic, but would be great to use SQLite in the browser instead of IndexedDB. I love relational databases, but you're almost forced into a NoSQL approach when developing a SPA since the client (browser) only supports simple key -> value storage. It would be a dream to use LINQ-to-SQL, or similar type safe query DSLs like Slick or Quill (Scala), or Esqueleto (Haskell) in the browser. Combine that with a singl…

This almost happened. Ten years ago "WebSQL" was being considered as a standard - it would have introduced SQLite-backed databases as a built-in browser feature: https://en.wikipedia.org/wiki/Web_SQL_Database The W3C dropped it in November 2010 because they were uncomfortable supporting a web standard which was entirely tied to a single implementation of SQL (SQLite). I adore SQLite but I think the W3C made the right…

> I adore SQLite but I think the W3C made the right call there - web standards need more than one compatible implementation.

could you elaborate on that? I get the impression that now, eight years later, we're much worse off. I don't really see the upside of not going for what is, AFAIK, a relatively vanilla implementation of SQL.

Re: SQLite Release 3.25.0 adds support for window functions

#93
post #12

This is super cool. Does anyone know how to upgrade python3's sqlite module to the latest version?

You can use https://github.com/coleifer/pysqlite3 It even supports user-defined window functions using the new sqlite apis.

Charles provided really great documentation on how to build this here: http://charlesleifer.com/blog/compiling-sqlite-for-use-with-...

Or if you're feeling lazy (like I was), there's a fork of his library at https://github.com/karlb/pysqlite3 which compiles the 3.25.0 amalgamation by default. This worked for me:

    $ python3 -mvirtualenv venv
    $ source venv/bin/activate
    $ pip install git+git://github.com/karlb/pysqlite3
    Collecting git+git://github.com/karlb/pysqlite3
    ...
    Installing collected packages: pysqlite3
    Successfully installed pysqlite3-0.2.0
    $ python
    Python 3.6.5 (default, Mar 30 2018, 06:41:53) 
    [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import pysqlite3
    >>> pysqlite3.connect(":memory:").execute("select sqlite_version()").fetchall()
    [('3.25.0',)]

Re: SQLite Release 3.25.0 adds support for window functions

#95
post #87

A bit off topic, but would be great to use SQLite in the browser instead of IndexedDB. I love relational databases, but you're almost forced into a NoSQL approach when developing a SPA since the client (browser) only supports simple key -> value storage. It would be a dream to use LINQ-to-SQL, or similar type safe query DSLs like Slick or Quill (Scala), or Esqueleto (Haskell) in the browser. Combine that with a singl…

This almost happened. Ten years ago "WebSQL" was being considered as a standard - it would have introduced SQLite-backed databases as a built-in browser feature: https://en.wikipedia.org/wiki/Web_SQL_Database The W3C dropped it in November 2010 because they were uncomfortable supporting a web standard which was entirely tied to a single implementation of SQL (SQLite). I adore SQLite but I think the W3C made the right…

> web standards need more than one compatible implementation

Seems like a similar situation to WebGL. I think they would have looked past implementation count if the feature was really needed.

Re: SQLite Release 3.25.0 adds support for window functions

#96
post #86

A bit off topic, but would be great to use SQLite in the browser instead of IndexedDB. I love relational databases, but you're almost forced into a NoSQL approach when developing a SPA since the client (browser) only supports simple key -> value storage. It would be a dream to use LINQ-to-SQL, or similar type safe query DSLs like Slick or Quill (Scala), or Esqueleto (Haskell) in the browser. Combine that with a singl…

> A bit off topic, but would be great to use SQLite in the browser instead of IndexedDB That almost happened. There was a thing called WebSQL [1] that was W3C was working on to add SQL to the browser. Everyone who implemented it used SQLite. Apparently, that disqualified it from standardization. To move ahead, they wanted to see independent implementations of the standard. No browser makers stepped up to reduce the q…

> Everyone who implemented it used SQLite

They had to, since what was standardized was specifically the SQL dialect of SQLite v3.6.19.

> No browser makers stepped up to reduce the quality of their implementation by replacing some of the best designed, best written, best tested code on the planet with some other SQL back end to satisfy the committee

There were only two implementations at all: WebKit and Opera. Mozilla and Microsoft weren't going to implement it without a spec decoupled from particular backend.

Re: SQLite Release 3.25.0 adds support for window functions

#98
post #16
post #11

Earlier quoted context omitted.

Ditto! For anyone who isn't familiar with SQLite's testing procedures, read this[1] fascinating page. The SQLite project has a mind boggling 711 times more test code than SQLite itself has. Put another way, only 0.1% of the project's code is SQLite itself. The other 99.9% consists of tests for that 0.1%. [1] https://www.sqlite.org/testing.html

In a similar vein, I rarely (if ever) seen a library that handles dynamic memory allocation more robustly than SQLite. This page is a glory to behold: https://www.sqlite.org/malloc.html

That page is inspiring, for a commodity, open source and old software project everything is very clearly defined and the language is very definitive which I hope is indicative of the actual library quality (I’ve never used SQLite).

Re: SQLite Release 3.25.0 adds support for window functions

#99
post #92
post #87

Earlier quoted context omitted.

This almost happened. Ten years ago "WebSQL" was being considered as a standard - it would have introduced SQLite-backed databases as a built-in browser feature: https://en.wikipedia.org/wiki/Web_SQL_Database The W3C dropped it in November 2010 because they were uncomfortable supporting a web standard which was entirely tied to a single implementation of SQL (SQLite). I adore SQLite but I think the W3C made the right…

> I adore SQLite but I think the W3C made the right call there - web standards need more than one compatible implementation. could you elaborate on that? I get the impression that now, eight years later, we're much worse off. I don't really see the upside of not going for what is, AFAIK, a relatively vanilla implementation of SQL.

A web standard needs to have more than one implementation. If you allow one single implementation to define the standard, you get something like Flash.

I don't have a particularly strong practical argument here: for me this is more of a fundamental principle for how the web should work.

Re: SQLite Release 3.25.0 adds support for window functions

#100
post #27

A bit offtopic but has anyone tried to replicate sqlite databases? Using rqlite https://github.com/rqlite/rqlite or something else?

Bedrock [1] by Expensify is supposed to be solid. Master/slave async replication (i.e. all slaves are read only), pluggable, provides full SQLite access via the MySQL protocol.

[1] http://bedrockdb.com

Post reply on HN