16 ms·
Appropriate Uses for SQLite
- xiaomai 10y agoI run the backend/website of my side business on sqlite. It is one of the best technology decisions I have made. It performs reasonably, is super straightforward (at my day job we have a team of postgres people to keep our dbs running smoothly, but for my little side business I don't have those resources); backups are dead simple. I love sqlite.
- chii 10y agoHow do you handle concurrent access to your db?
- Scaevolus 10y agoMost applications don't actually need concurrent access. SQLite handles concurrent reads without any issues, with writes requiring exclusive locks. As long as your queries are fast and your write load is minimal, you won't really have any problems.
- teraflop 10y agoWhat you describe is the way SQLite worked originally. With the newer WAL mode, things are slightly better -- you can still only have one active write transaction at a time, but writers no longer block readers.
- Scaevolus 10y agoGood point! I find WAL mode especially useful when long write transactions would starve reads.
- wila 10y agoSo I read about WAL mode down here and cheered because it sounded like it would solve the occasional "database is locked" error that the app I am working on is bumping into. The database is only opened by 2 users on the same machine. One is a normal user, the other one is root for a daemon process. That by itself might be an uncommon scenario. So I tried it out this morning and found that any writes are invisible unless I restart the app to close the database. For my use case that isn't an improvement as writes made by either user should be visible by the other user. Even tried it with setting read_uncommitted to true, but that did not help either. Of course it is possible I am still doing something wrong, but at this moment it doesn't look like the WAL journal mode is an option for my app. A pity as I expected -without WAL- to be able to read when another process is writing, well just a delayed read would be fine, but instead there's a -database is locked- error that pops up to the user.
- domador 10y agoSorry to ask an obvious question, but are both users committing their transactions? Does the other user requery after a transaction?
- wila 10y agoYeah, they both can write, although almost all of the writes are done by the daemon process and the normal user (the GUI process) reads and processes the results. The 'database is locked' problem seemed to happen most while the daemon user is writing and the normal user is reading. For the moment I added a patch to my apps whereby the applications handle the locking by itself at a slightly higher level as I got a bit tired of the problem. This is done via a separate lock file that is opened exclusively before any write action and closed after the write. By doing that I can simply delay the reads for a bit when the GUI process tests to open the lock file and that appears to have cured most problems. It's a tiny bit more advanced as the above, but that's basically it and it appears to have cured most issues. edit: might have misread your question, was it about the WAL journal mode? Yes the processes do commit the transactions they write. I need the results immediately, not after sqlite decides to process the WAL journal.
- jack9 10y ago> Most applications don't actually need concurrent access That's an interesting claim. I would rephrase that to, "Are their more http calls that use concurrent connections to a DB, or standalone applications that do not?" I would wager the former.
- qwertyuiop924 10y agoI think what GPP meant is that most apps don't need concurrent writes.
- the_duke 10y agoSQLite is not such a great choice for the server side. SQLite typically get's used on the client side portion, either as a "caching db" for offline work, or for client side only programs without a server backend.
- emn13 10y agoThe sqlite website runs on an sqlite db. Even on most websites, I suspect the need for concurrent, long-lived write transactions is much rarer than people assume. If your write transactions are short-lived, then sequential execution is a reasonable approximation of (slow) concurrency, at which point it's a question of load whether that's good enough. But the window in which it's not good enough is very slim - hardware simply isn't all that concurrent in the first place, and as you scale, some sharding strategy is required anyhow. So the more plausible limitation is long-lived write transactions; e.g. where a write cannot be committed until after some other confirmation occurs, possibly over the network. That simply won't work well at all in sqlite - not that it's a great strategy to use on other DBs...
- icebraining 10y agoThe sqlite website runs on an sqlite db. Yeah, but the sqlite website doesn't need a db at all.
- emn13 10y agoWell, "need"... To quote the sqlite website itself: > The SQLite website (https://www.sqlite.org/ https://www.sqlite.org/) uses SQLite itself, of course, and as of this writing (2015) it handles about 400K to 500K HTTP requests per day, about 15-20% of which are dynamic pages touching the database. Each dynamic page does roughly 200 SQL statements. This setup runs on a single VM that shares a physical server with 23 others and yet still keeps the load average below 0.1 most of the time. I think its fair to assume that the sqlite site could be redesigned to meet most of its functionality as a largely static site, but that would come at a loss of functionality. And obviously it's a form of dogfooding, but that's not objectionable, right?
- AstroJetson 10y agoRead and understand this document: https://www.sqlite.org/lockingv3.html It is the inside the engine on how to do things. There are exact steps that need to be done the way the document reads to make it happen. There is a also big section on how to corrupt the database. It's a heads up that if you decide to do shortcuts there will not be a happy ending. A little more complicated doing concurrent use than with something like MySQL, but there is much more engine on the MySQL side. If multiple concurrent users with high transaction levels, SQLite may not be your best first choice.
- xiaomai 10y agoThe WAL (https://www.sqlite.org/wal.html https://www.sqlite.org/wal.html) facilitates concurrency.
- edwinyzh 10y agoWe use mORMot(https://github.com/synopse/mORMot https://github.com/synopse/mORMot) to achieve concurrent access. On windows it utilizes the http.sys engine (which is the same used by IIS the Microsoft web server) With FreePascal it also works on Linux .
- beagle3 10y agoSQLite has always supported multiple readers, which is the most common concurrent access pattern. Before the WAL (Write-ahead log) was introduced, a writer would block readers (and vice versa), but with a WAL, a single writer and multiple readers do not block each others. SQLite does not have multi writer concurrency (usually MVCC as in Oracle/MySQL/PostgreSQL or optimstic transactions like Backplane). If you need those, SQLite is not for you.
- nilved 10y agoThis used to be how I felt, since the performance criticism of SQLite is vastly overblown. However, the safety criticism of a dynamically typed database is vastly underblown. Since it completes with fopen(), you get about as much structure and validity.
- jstimpfle 10y agoI'm currently developping a text format called WSL[1]. By nature text files don't have indices, but it is strongly typed, supports standard relational integrity constraints, and indices can be automatically created when reading the file. There is a currently only a simplistic python library which reads databases at about 1MB/s. On the plus side it's dead simple to use, only a single library call to parse a file as schema, tables, and indices. There is also a C library in development which lexes at about 300-600 MB/s in a single thread (depending on how many columns are actually needed and thus have to be written to per-column lexem buffers) and which I hope will have a release next month. [1] http://jstimpfle.de/projects/wsl/main.html http://jstimpfle.de/projects/wsl/main.html
- qwertyuiop924 10y agoWhat's the safety issue? Will your data corrupt, or are your types just not 100% guaranteed? Because I can live with the ladder: weak types suck in programming languages, but are okay in DBs, and the types get verified multiple times on their way in and out of the DB in most systems. Besides, it won't mangle your data. Unlike some DBs that I could name...
- nilved 10y agoI don't think it would mangle your data directly, but it could lead to incorrect results since there is a degree of mystery from query to query. You should definitely base a conclusion on their words and not mine. https://www.sqlite.org/datatype3.html https://www.sqlite.org/datatype3.html
- qwertyuiop924 10y agoThanks for the link. Yeah, it's as I remember: type affinities will convert to their type if possible, and if not... well, you get out what you put in. The reason most people don't complain about this is that it's a far from common issue to totally miswrite your SQL statements so badly that you wind up mixing up columns. And when you do, it's usually detected pretty fast.
- AstroJetson 10y agoI've always loved this line: SQLite does not compete with client/server databases. SQLite competes with fopen(). I have some small apps that I've written in TCL that use SQLite that I've been very happy with. Not much more effort than using a file. There are also some nice hooks to allow the use of SQLite from Lua scrips. It's pretty easy and it fits into the Lua world view of data.
- hackits 10y agoI found it useful for logging. Logging tends to have structured data associated with it. Trying to re-parse log files into some meta data gets tiresome and is error prone.
- qwertyuiop924 10y agoHonestly, I'd say that logging should be text. Yes, SQLite DBs are hard to corrupt, but it can happen, especially in the sort of catastrophic failure you would want a log for. And when data corrupts, it's generally easier to extract some degree of data from a text file than from a binary. Maybe as a log archive format, though...
- michaelcampbell 10y agoAh, systemd.
- vacri 10y agoDon't worry, you can just have journald send loglines across the network to a centralised logserver... ... oh, wait, that hasn't been solved yet. Instead, there's a variety of hacky workarounds (send it to rsyslog and get it to ship; follow a journal with ncat and ship that; some others). Centralising journald logs is my current ops problem de juor.
- simcop2387 10y ago
- SixSigma 10y agoI <3 Sqlite.
- lucb1e 10y ago> People who understand SQL can employ the sqlite3 command-line shell to analyze large datasets. And a bit further down: > SQLite database is limited in size to 140 terabytes [...] if you are contemplating databases of this magnitude [use something else] Yeah no. "Large datasets" here means a few megabytes. I figured that out the hard way: I had a database of about 70 megabytes and ran a query with "COUNT(a)" and "GROUP BY b" on it. This makes it write multiple gigabytes to /tmp until it goes "out of disk space" (yeah /tmp on my ssd isn't large). I heard nothing but awesome and success stories about SQLite until a few weeks ago when this fiasco happened. I still like SQLite for its simplicity and last week I used it again for another project, but analyzing "large" datasets? Maybe with a simple SELECT WHERE query, but don't try anything more fancy than that when you have 100k+ rows.
- qwertyuiop924 10y agoThat seems odd. Have you looked at the SQL docs for why this might be? Also, have you compared this to what other DBs do?
- pmorici 10y agoHow you considered you might have used it wrong? If everyone else says it works great and you use it and have an issue my first thought would be I must have done something wrong not this sucks everyone else must be wrong.
- lucb1e 10y agoSound logic, but I didn't think to myself "gee everyone else is wrong". I just noticed SQLite did something I've never seen another database do and figured it's not made for this.
- vacri 10y agoI find this happens quite often - once you stray from the most common path for $AWESOME_TOOL, you start finding little oddities here and there. It's not that 'everyone else is wrong', it's just that you're off the beaten track.
- 10y ago
- Lxr 10y agoSQLite works great as the database engine for most low to medium traffic websites (which is to say, most websites)...Generally speaking, any site that gets fewer than 100K hits/day should work fine with SQLite. Do people agree with this? I was under the impression you should not use SQLite for production websites for some reason. Django has this to say, for instance [1]: When starting your first real project, however, you may want to use a more robust database like PostgreSQL, to avoid database-switching headaches down the road. [1] https://docs.djangoproject.com/en/1.10/intro/tutorial02/ https://docs.djangoproject.com/en/1.10/intro/tutorial02/
- keithnz 10y agoIf you just look at its capability, yes, it can work great for a website. However, sqlite is limited in what it can do, so when you need to go beyond what it can do then it can be a pain. I'd say sqlite is a DB choice for people who understand what each DB option gives them. If you were new and needed a default choice, then pg, or mysql, or sqlserver are going to be pretty flexible long term. You also are going to get a lot more technical info on the web about how to use it with whatever web framework you have chosen. However, I have used it for websites where I have a pretty good idea about my data needs. works fine. I use it more in the "competes with fopen" case though. Super great as a settings / info / persistence store
- bpicolo 10y agoMoving to an entirely different database is a monumental task, so if you start with the right tool you won't have to deal with that
- nostrademons 10y agoGetting a site from zero to 100K hits/day is also a fairly monumental task, and if you don't succeed at that, you don't have to move to a different database.
- TylerE 10y agoWith Django it really isn't, as all of the differences are (in theory at least...) abstracted away behind a common API.
- danso 10y agoI teach SQL to non-techie students. I used to give the the option of doing either MySQL or SQLite, but not only did I underestimate how different the syntaxes were, I also underestimated how not-trivial it is for students to successfully install and run both the MySQL server and client. These are students who can't even use a spreadsheet well, not that that makes a huge difference in understanding databases. I've moved everything to SQLite and couldn't be happier. Not only is it easier to distribute assignments (e.g. a single SQLite file, instead of CSVs that need to be manually imported), it does everything I need it to do to teach the concepts of relational databases and join operations. This typically just needs read-only access, so our assignments can involve gigabytes of data without issue.
- RangerScience 10y agoNote: http://postgresapp.com/ http://postgresapp.com/ is trivial to install, although it only works on macs, is still more involved than a file, etc etc...
- danso 10y agoThe one thing missing from SQLite is stronger type casting...however, SQLite does have a solid, cross-platform GUI in DB Browser [0]. It's not as nice as Sequel Pro and some of the commercial clients for MySQL. Postgres, unfortunately, doesn't have near the variety of reliable clients that MySQL and SQLite do. However, SQLite follows most of the standard syntax that Postgres does, so having students move right into CartoDB, which lets you run raw Postgres, has never been a problem.its just the self hosting that's a pain :). One more thing that I wish I could have from Postgres as a teacher: how it returns an error when you include non-aggregated columns in the SELECT clause. In MySQL and SQLite, selecting extra columns won't throw an error, and the results look close enough to correct to be fairly dangerous for novices. Better to just throw an error as Postgres does. [0] http://sqlitebrowser.org/ http://sqlitebrowser.org/
- placebo 10y agoAnother good cross-platform GUI for SQLite that I've been using for years is TkSQLite (http://reddog.s35.xrea.com/wiki/TkSQLite.html http://reddog.s35.xrea.com/wiki/TkSQLite.html)
- chrismealy 10y agoWas there a time when using SQLite for websites would risk data corruption, or has it always had reliable locking?
- jchrisa 10y agoIt has been solid for a long time, because the testing is targeted at embedded applications where maintenance is not always an option. A HN favorite: https://www.sqlite.org/testing.html https://www.sqlite.org/testing.html
- qwertyuiop924 10y agoNot AFAIK. SQLite is the Samuel Vimes of software: It's not the fastest, or the strongest, but it's solid as a rock, and entirely dependable.
- ageofwant 10y agoIt is: "His Grace, His Excellency, The Duke of Ankh; Commander Sir Samuel Vimes", if you please.
- qwertyuiop924 10y agoYou know full well that he hates being called that.
- Esau 10y agoI am just an average, non-programming geek, and I love SQLIte. I use it to from the command line to track my blood pressure, my comic book collection, and my book collection. It also gave me the chance to learn SQL for fun. Sadly, it is not often looked upon as an end-user tool.
- qwertyuiop924 10y ago>I am just an average, non-programming geek Wait... Why are you on HN? It's not a problem or anything, I'm just kind of curious.
- eximius 10y agoI can tell you aren't trying to be malicious, but this implies that HN is only for 'programming geeks' which is ridiculous.
- qwertyuiop924 10y agoWell, the news that shows up is stuff primarily relevant to programmers... I just wonder who else would be interested
- mikeash 10y agoLooking at the front page right now, out of the 30 stories maybe 2-3 of them would only be of interest to programmers versus people interested in tech in general.
- qwertyuiop924 10y agoI suppose...
- sliverstorm 10y agoInteresting news?
- 10y ago
- qwertyuiop924 10y agoSQLite is quite possibly one of the most useful pieces of software ever created. It's small, relatively fast, and unbelivably solid. It's up there with bash, curl, grep, emacs, and nano: tools that are just so good at their job that we don't even notice how amazing they are. I mean, really. SQLite is remarkable, impressive, and used everywhere, and we never talk about it. Emacs is a remarkably impressive piece of engineering, bash is the world's default shell for a reason, Nano is the newbie's text edior, and, well, just imagine for a second what would happen if grep or curl stopped working.
- nine_k 10y ago> if grep and curl stopped working Did you ever run Windows?
- baq 10y ago$ curl --version curl 7.47.1 (x86_64-w64-mingw32) libcurl/7.47.1 OpenSSL/1.0.2g zlib/1.2.8 libidn/1.32 libssh2/1.7.0 librtmp/2.3 Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smtp smtps telnet tftp Features: IDN IPv6 Largefile SSPI Kerberos SPNEGO NTLM SSL libz TLS-SRP $ grep --version grep (GNU grep) 2.24 Copyright (C) 2016 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by Mike Haertel and others, see <http://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>. $ uname -a MINGW64_NT-6.3 redacted 2.5.0(0.295/5/3) 2016-03-20 18:54 x86_64 Msys $ :)
- JdeBP 10y agoNow crank up PowerShell, which is what I suspect xe is subtly getting at. (-:
- PeCaN 10y ago…without installing curl and grep? Nope.
- i_feel_great 10y agoA good resource on optimising write speed: http://stackoverflow.com/questions/1711631/improve-insert-per-second-performance-of-sqlite http://stackoverflow.com/questions/1711631/improve-insert-pe...
- ggregoire 10y agoWhat would be the arguments to not use MySQL for a business website, even a small one? Sure SQLlite does probably the job as well as MySQL, but I don't have any problems with MySQL and it's commonly the default option when choosing a RDBMS. Just curious.
- jdhawk 10y agoWhen you're a developer, not a systems guy, so the idea of running a "database server" sounds scarier than just opening a file.
- cyberferret 10y agoI use SQLite almost all the time now on my desktop apps especially, for logging and other data intensive tasks that require only a single read/write thread. It replaced text logging for me as searching and segregating log messages is now a breeze. I've also used it as a main data store for single user Win32 apps. In my early days of web app programming, I had an app that created a brand new SQLite data file for EACH customer that logged in and created an account on the web app. I thought it would be the most secure way to separate datasets and protect privacy for each user whilst negating the multiple write lock issues on the same SQLite database. Tip: Don't even bother to do this! The eventual data maintenance headache was far worse... :)
- stevekemp 10y agoMy personal favourite use for SQLite was for my blog. I wanted to use flat-files for storing individual entries, but I still wanted to present tag-views, and per-month entries. My solution was to create a simple SQlite database, import all the entries into it, and then generate the views by SELECTing from that store. Populating the database, even if it got thrown away immediately afterwards, was more efficient than trying to store all the entries in RAM. https://github.com/skx/chronicle2 https://github.com/skx/chronicle2
- cyberferret 10y agoYes, temp storage is another 'use case' for me too. On one particular web app I designed, there is a requirement for searching across multiple tables for text data. I simply transpose the columns I need from the different tables into a memory SQLite database 'on the fly' and perform a full text search on that for lightning quick responses and no need to do multi table joins.
- Const-me 10y agoFor Windows, “Many concurrent writers? → choose client/server” heuristic isn’t right. On Windows, we have this: https://en.wikipedia.org/wiki/Extensible_Storage_Engine https://en.wikipedia.org/wiki/Extensible_Storage_Engine ESENT plays very nice in high-concurrency scenarios. Implementing client/server where you only need an embedded DB comes at price. It bloats and complicates the installer, increases attack surface, conflicts with other software for listening TCP port number, interferes with firewalls, consumes more resources, slows the startup, etc…
- theseoafs 10y agoI'm looking at a project right now where I'm planning to use SQLite as a high-level solution to file locking (i.e. create a record in the DB to "lock" a file, delete it when you're done, and don't create a record if a record for that file is already in the DB). Sound like an appropriate use of SQLite? Is there a better, more direct solution? (I understand there are platform-specific utilities but I would want something portable.)
- chj 10y agoThis is what people say you bring whole jungle just because you want the banana.
- theseoafs 10y agoFor the record, the application already has SQLite, I just figured I would use it while it's there.
- AtheistOfFail 10y agoThe main argument against is that a SQLite lock won't stop other processes from messing with the file, instead use a system-based lock.
- mappu 10y agoYou'll need a solution to handle stale locks if the process dies without removing the record.
- tracker1 10y agoMost higher level languages have a flock or equivalent library that is cross platform (win/linux/mac). If you need exclusive locks, I haven't seen an interface for accessing files in languages above C that don't have exclusive lock already.
- mirekrusin 10y agoIt's not a good idea because different processes shouldn't write to the same sqlite database. Unless you design it as a service, where one process is using sqlite to store its locking data and you use it from other processes by communicating with this service - then it's ok.
- optforfon 10y agoI've never had the occasion to use an SQL database. But say I was writing a game using C++ - at what point would I go from managing a bunch of maps or vectors of entities to using a SQL database? If I was writing a ray tracer and needed to store vertices, would it makes sense to use a SQL database? How about for a list of object? Or textures? In general I often need to filter on objects, update object state, generate new objects, remove some others, etc. but I never know when I should stop thinking containers and start thinking "aha! time for SQL"
- cdelsolar 10y agoBasically any time you want to persist data to disk.
- gh02t 10y agoIt's not really appropriate for any of those things. You should use a database to store data that you want to keep after the program terminates, not so much transient things like in-memory data structures. It's also best used for relational data- stuff that is logically linked together. For developing a game, maybe storing item tables with items and stats or the player's inventory might be good candidates. Sqlite in particular is good for this because it's easily embedded and a lot of games use it from what I know. This is oversimplifying a good bit, but it's hard to completely describe the scope of relational DBs.
- optforfon 10y agoI've definitely come across it being referenced for use in games. Specifically the "Component" design pattern is supposed to use it. It's kinda described here: http://gameprogrammingpatterns.com/component.html http://gameprogrammingpatterns.com/component.html But the author doesn't take it to it's logical conclusion. I found the full explanation by it's inventor here, in this slide deck: http://scottbilas.com/files/2002/gdc_san_jose/game_objects_slides.pdf http://scottbilas.com/files/2002/gdc_san_jose/game_objects_s... But I'm fuzzy on the details
- int_19h 10y ago>> For developing a game, maybe storing item tables with items and stats or the player's inventory might be good candidates Doubtful. Player inventory is not going to be large enough to bother, and item tables you'll want to be in-memory anyway, so you might as well just read them from CSV, JSON, XML etc (and that way you can easily edit them, too). I would say that SQLite only makes sense when your dataset is too big to be entirely loaded into memory in a cooperative environment (i.e. assuming that your app is not allowed to hog the entire memory). I'd say that starts at tens of megabytes.
- Nican 10y agoI always wondered if using SQLite for the back end for a distributed map/reduce jobs was efficient. Each machine holds part of the data in an SQLite file. It would not solve the usual sort/group by problems that require cross-machine communication, but would take full advantage of SQLite's optimizations for other problems.
- jeremy_wiebe 10y ago> Each dynamic page does roughly 200 SQL statements. I haven't done web work in a while but am I the only one who thinks that's a ridiculously high number for a single page?
- kazagistar 10y agoName widget asks the name endpoint, date widget asks the date endpoint, age widget asks the age endpoint...
- pmontra 10y agoMore or less the Kibana dashboard's way of doing things, which destroys the Elasticsearch machine and forces setting up a cluster with GB of RAM and multiple CPUs even if it sits doing nothing between refreshes. The dashboard could serialize the queries and that web service could combine those queries into one, get the name, date and age and demux the result to the single widgets.
- the_duke 10y agoIt's correct if you are using some framework like Drupal, and caching is not enabled. Any FB page probably also needs that many. For most sites, 200 queries is way, way, way too much.
- majewsky 10y ago> [Is 200 SQL statements] a ridiculously high number for a single page? It is, but it does happen, usually due to design decisions. When I was still young enough to do PHP (about a decade ago), one of my largest projects was a domain-specific CMS for code collaboration. It was all working fine on my development system, but in production, every page loaded for at least 4-5 seconds. I inspected into the DB queries that were used to build a single page, and found a lot of duplicate SELECT * FROM {table} WHERE id = {id}; because of how the model classes were built. Since it was too late to change the architecture, I sent these types of statements through a simple cache and brought the amount of queries per page down from a few hundred to below 10.
- SQLite 10y ago
- deadlyllama 10y agoI used SQLite to analyze web server logs at my last job (devops at Xero). SQLite supports in memory databases which are very fast. I'd parse a bucket of logs into a table, then run some queries against them and write the results into Graphite. The results ended up on the ops wall, and generating another data point was one more SQL query in a config file away. Wonder if they're still using it.
- JohnTHaller 10y agoWhen people say SQLite is everywhere, they mean it. Heck you're likely using it right now as you browse HN since Firefox, Chrome, Opera, etc all use it.
- mbrock 10y agoI noticed the other day that the AWS Lambda runtime environment has the sqlite3 binary already installed in $PATH.
- thom 10y agoI've used SQLite for single-user analytics in the past and it's fine up to a point. It's slightly more SQL-literate than MySQL - it supports CTEs but not window functions - and it has an okay GIS extension. I've also been pleasantly surprised by performance in some cases. However, I was recently pointed at MonetDB: https://www.monetdb.org/Home https://www.monetdb.org/Home Monet's an open source column store, and I think it's worth evaluating by anyone doing offline analytics or research-driven work.
- nbevans 10y agoWe use SQLite as a data integration tool. We connect to a third-party system's esoteric database using an ODBC driver. Then export tables to a SQLite database. This process can sometimes take a few minutes but is generally quite quick. Then the SQLite database is compressed and uploaded to cloud blob storage. Effectively at this point it is a "snapshot" of the third party system's state. Our cloud system is then tailored with SQLite queries to know how to use and understand that foreign schema. By doing it this way we avoid needing to know several dozen SQL dialects for esoteric database engines that "never won the race in the 1990s" (think Progress, Ingres, Paradox, etc). It means we only need to know SQLite - a current, OSS and well supported variant of SQL. Epic cost and time savings are the net result.
- cheriot 10y ago> SQLite supports an unlimited number of simultaneous readers, but it will only allow one writer at any instant in time. This is the one that usually gets me. For whatever reason, I tend to prefer side projects that are "take a dataset and make a tool out of it". It often ends up with simultaneous bulk writes when the dataset is updating. I'm a big sqlite fan. Just throwing this out as a limitation for anyone deciding if it's appropriate for their project.
- Vintila 10y agoSlightly off-topic but I love their sql docs[1], those diagrams are just beautiful. [1] https://sqlite.org/lang_createtable.html https://sqlite.org/lang_createtable.html
- contingencies 10y agoThey are semi-regularly discussed here, and are known as syntax diagrams or railroad diagrams. You can find a good list of generation tools at https://en.wikipedia.org/wiki/Syntax_diagram https://en.wikipedia.org/wiki/Syntax_diagram
- contingencies 10y ago"Anything without frequent concurrent writes" pretty much sums it up.
- contingencies 10y ago"Anything without frequent concurrent writes" pretty much sums it up.
- red_admiral 10y agoI used SQLite for teaching last year because it was the only thing that I could get IT to install between when I took over the databases unit and the start of term. While it was broadly a success, I consider the following major problems when teaching to beginners: * very loose syntax. CREATE TABLE PERSON ( ID BANANA BANANA BANANA ); is legal :) * no type-checking: you can insert strings into an INTEGER column and vice versa - while you're trying with a straight face to teach students that one of the advantages of a proper database is that it can enforce some consistency on your data. * in the same vein - foreign key constraints are NOT enforced by default. * misusing GROUP BY produces results, but not the ones you want. I'd much rather any use of aggregates that is forbidden by the standard also gave an error, to discourage students from thinking "it produces numbers, therefore it must be ok". This year, I'll try with MariaDB. I consider SQLite an excellent product for many things and use it extensively myself, but as a teaching tool its liberal approach to typing is a drawback.
- kartikkumar 10y agoI use SQLite to store all of my simulation data (~10s of GBs). It's remarkably versatile and the fact that there are good libraries for Python and C++ to interface with and query SQLite dbs makes it a synch to use for data analysis. I've seen so many people struggle with custom binary formats; I imagine there are countless research hours lost in figuring out how to work with these obscure formats. I've advocated to all students I work with to make use of SQLite to store simulation data for their thesis projects and my experience is that they're quick to pick it up and figure out how to do some pretty complex querying. It's one of those things that I don't understand about academia: there are so many standards and well-established tools in the tech/IT sector that we don't take advantage of. SQLite and JSON are the two that I constantly advocate to everyone I work with.
- mirekrusin 10y ago"Application file format" is the thing which intrigues me. I think people don't think about it as an option enough, it should be used more frequently. File format versions backed by migrations, trivial inspection of data, transactional for free, you can keep recent history of changes, hierarchy etc. It's pretty good.
- trengrj 10y agoI recently made a tool for command line history to a sqlite database https://github.com/trengrj/recent https://github.com/trengrj/recent. I really enjoy using sqlite. Not everything needs a client server model, and having your entire database located in a single file makes a lot of things way easier.
- zmmmmm 10y agoI love SQLite up until you need to modify the schema. That's when you find that upgrading an in place database is almost impossible. Rebuilding a whole table just to rename a column is just completely impractical and makes maintaining applications really cumbersome.
- tmaly 10y agoI use sqlite for an intermediate representation of a report that is rendered to multiple worksheets. I find having the data in sql lets me perform all types of transformations that are not easily handled outside of sql.
- kennell 10y agoI run a number of 1%-write, 99%-read web apps with decent traffic on SQLite. Works like a charm. It is low maintenance and creating a "backup" is simply copying the file.
- bnolsen 10y agofossil scm is a dvcs built around sqlite. one executable, very few dependencies and atomic transactional safety. workflow wise its more like cvs or svn properly converted into a dvcs. great for small teams, integrated web server, wiki issue tracking. http://fossil-scm.org http://fossil-scm.org