First Contact with SQLite
The article explores surprising aspects of SQLite, like limitations in altering columns and data types. It notes the recent jsonb support and handling date/time values, praising SQLite's streaming features but favoring PostgreSQL.
Read original articleThe article discusses the author's recent exploration of SQLite, highlighting surprising aspects of the database. Some key points include the lack of support for altering columns or dropping constraints directly, the absence of data types on columns (only on values), and the potential for SQLite to behave unexpectedly when dealing with unsupported types. The author notes the recent addition of jsonb support in SQLite, clarifying that it functions as a format rather than a distinct data type. Additionally, the absence of certain critical types like timestamptz is mentioned, with suggestions on how to handle date/time values in SQLite. Despite some initial challenges, the author acknowledges SQLite's impressive streaming features while reaffirming their belief in PostgreSQL as a top-tier database.
Related
At 50 Years Old, Is SQL Becoming a Niche Skill?
SQL, a foundational technology, faces scrutiny in today's IT world. Evolving roles like data scientists challenge its centrality. Debates persist on SQL's relevance against newer technologies like JSON queries, impacting its future role.
Graph-Based Ceramics
The article explores managing ceramic glazes in a kiln and developing an app. It compares Firebase, Supabase, and Instant databases, highlighting Instant's efficiency in handling complex relational data for ceramic management.
Optimizing Large-Scale OpenStreetMap Data with SQLite
The article discusses optimizing large-scale OpenStreetMap data with SQLite. Converting OSMPBF to SQLite enhanced search functionalities. Indexing, full-text search, and compression improved query performance, despite some false positives.
Graph-Based Ceramics
The article explores managing ceramic glazes in a kiln and creating an app for this purpose. It compares Firebase and Instant databases, Supabase, Postgres, and InstaQL for efficient data handling.
Graph-Based Ceramics
The article discusses managing ceramic glazes, introducing a custom app. It compares Firebase and Supabase databases, opting for Supabase's better data modeling. Instant database is explored for a hybrid solution.
I find these 'different therefore wrong' takes to be immature.
Yes, SQLite is idiosyncratic in comparison to other relational database engines. There are reasons behind those idiosyncrasies: SQLite is designed for other use cases than those other engines, and therefore has other design decisions.
Ultimately, all computer programs are solutions to problems, and the approach to solving a problem depends on the nature of the problem. A list of grievances and a Boolean judgment is useless without stating the problem that the author is trying to solve.
My favourite feature of my sqlite-utils CLI tool is the "transform" command which implements this pattern for you (also available as a Python library method): https://sqlite-utils.datasette.io/en/stable/cli.html#transfo...
This seems very blunty anti-sqlite, and things postgreSQL is the best, so I'd be interested to see a guide for (two things I've used sqlite for in the last week):
* Using postgreSQL to store data in an iPhone app
* Making a small python script which uses PostgreSQL, and then seeing how much work it is to send that to someone else, so they can use your work and extend it (send the database, and also instructions for installing postreSQL, and getting everything set up. Make sure it works on linux, mac and windows).
I'm not saying it does not deserve the attention, it is a fantastic piece of software but if I had the option to use PostgreSQL for something I'd never ever get close to choosing SQLite over it. It shines when you don't need or want something more feature packed.
1) strict always enforced.
2) full datatypes (ints, floats, datetime, jsonb)
3) all "ALTER TABLE" functionality, even if it has to rewrite the table
He heard a hype (sqlite), decided to try it to see what is it about, found out it's not for him really, wrote a bit blurb about it on his blog.
So it's more a short set of notes (like a TIL) than a full-fleshed blog post. Brandur's long-form writing has a different tone: https://brandur.org/articles
I don't understand the comparison here at all.
Although conceptually I agree that SQLite's limited type system is frustrating, if your usecase allows, an ORM might help with not having to think about it or touch it directly.
- So make breaking changes as needed. (it was first released in 2000 and has fantastic backwards compatibility, but hardware & OS have radically changes over the last 24 years - as well as use cases).
- put more focus on client/server use cases
- make things more 'strict' (types, checks, etc)
Note: I say this with tremendous love for SQLite. There's just so many attempts for companies & projects to morph SQLite what it's not designed for, that you might as well embarrass these use cases and make an official fork to support them.
You can use CREATE TABLE STRICT[1] to get a typed table.
1. It started as a way for the author to access databases from TCL, in which everything is a string. Sounds kind of mad now, but that was the kind of thing you did back in the 90's.
2. SQLite is fanatically backwards compatible. That means that once you get a system that works, it will continue to work through all newer versions of SQLite. But that also means that you can't suddenly decide to enforce foreign keys or column types by default, because it will break loads of systems that worked just fine before.
Perhaps the debate might be over how much trouble is too much. AFAICT automated "find and replace" can cure just about every "incompatibility".
There are some neat things you can do with it like using HTTP range queries to query it directly from object store or Litestream, but my point stands.
Its straightforward, fast and easy for a casual DB programmer. Everything is wrapped in SQLAlchemy anyway, so all the complicated logic is in my Python code.
Which have been around ALTER_TABLE and CONSTRAINTS
Here are some notes about my experience, offered to anybody who might be able to use them. https://www.plumislandmedia.net/reference/sqlite3-in-php-som...
I recently built a product with the backend using SQLite as the data store and ran into all these issues and many more. It is frustrating. I use SQLAlchemy and Alembic. It seemed everywhere I turned, the docs said “it works this way in all databases, except SQLite where X isn’t supported or you have to do Y differently.”
I think with litestream and D1 and other web SQLite tech emerging, you see the sentiment: “if you don’t have Google-scale, you can easily serve using disk-backed SQLite, plus enjoy skipping RTT network latency to DB.” Then, when someone does that and has a bad time, the comments instead go: “SQLite is only for embedded data stores.”
Personally, if I had to do it again, I would stick to the most boring tech for the target stack: Postgres and Django’s ORM.
Related
At 50 Years Old, Is SQL Becoming a Niche Skill?
SQL, a foundational technology, faces scrutiny in today's IT world. Evolving roles like data scientists challenge its centrality. Debates persist on SQL's relevance against newer technologies like JSON queries, impacting its future role.
Graph-Based Ceramics
The article explores managing ceramic glazes in a kiln and developing an app. It compares Firebase, Supabase, and Instant databases, highlighting Instant's efficiency in handling complex relational data for ceramic management.
Optimizing Large-Scale OpenStreetMap Data with SQLite
The article discusses optimizing large-scale OpenStreetMap data with SQLite. Converting OSMPBF to SQLite enhanced search functionalities. Indexing, full-text search, and compression improved query performance, despite some false positives.
Graph-Based Ceramics
The article explores managing ceramic glazes in a kiln and creating an app for this purpose. It compares Firebase and Instant databases, Supabase, Postgres, and InstaQL for efficient data handling.
Graph-Based Ceramics
The article discusses managing ceramic glazes, introducing a custom app. It compares Firebase and Supabase databases, opting for Supabase's better data modeling. Instant database is explored for a hybrid solution.