Questions tagged [sqlite]

SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine.

SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. SQLite is the most widely deployed SQL database engine in the world. The source code for SQLite is in the public domain.

SQLite is a relational database management system contained in a small (~350 KB) C programming library. In contrast to other database management systems, SQLite is not a separate process that is accessed from the client application, but an integral part of it.

SQLite is ACID-compliant and implements most of the SQL standard, using a dynamically and weakly typed SQL syntax that does not guarantee the domain integrity.

Making an MRE for SQLite questions on StackOverflow

Providing a minimal reproducible example for an SQLite-related question is most usefully and conveniently done by showing a few lines in SQLite syntax (i.e. some create table ... and insert ... which make a tailored toy database with appropriate structure and sample data).

This way, potential answerers can easily recreate the database you used for demonstrating the problem and quickly and efficiently provide solution proposals that are supported by test runs and test output. Showing pictures of database viewers or table representations (even in ASCII art) does not provide the same benefits.

If you already have created a database for demonstration purposes, consider using the .dump command of the SQLite commandline tool. It will automatically give you the lines for exactly recreating the database.

Getting familiar with the commandline tool also is a good way of avoiding all potential errors in whatever programming language is used to handle the database. With the commandline tool, you can inspect and analyse data and structure directly.

Mobile Apps

SQlite is commonly used to store data on Android, iOS, and Windows Phone apps since it has a simple implementation, easy to adapt, and quite fast.

Design

Unlike client-server database management systems, the SQLite engine has no standalone processes with which the application program communicates. Instead, the SQLite library is linked in and thus becomes an integral part of the application program.

The application program uses SQLite's functionality through simple function calls, which reduce latency in database access: function calls within a single process are more efficient than inter-process communication. SQLite stores the entire database as a single cross-platform file on a host machine.

References

Books

88183 questions
14
votes
1 answer

How can I attach an in-memory SQLite database in Python?

I'd like to merge SQLite databases, and some may be in memory. I create the in-memory databases by specifying the database path as :memory:. Following this post, using the attach feature of SQLite seems like both a simple and efficient approach. But…
Willi Ballenthin
  • 6,118
  • 5
  • 35
  • 49
14
votes
5 answers

ORDER BY alphanumeric characters only in SQLite

I am sorting songs in SQLite (on Android). I want to order them: Case-insensitive With leading-digits at the end, by integer value. Without punctuation (e.g. parentheses, periods, hyphens, apostrophes) I have 1 & 2 working (see below). However, I…
Phrogz
  • 271,922
  • 98
  • 616
  • 693
14
votes
4 answers

Django NodeNotFoundError during migration

The error I get when I try to runserver for my django app is as follows: django.db.migrations.graph.NodeNotFoundError: Migration tasks.0001_initial dependencies reference nonexistent parent node (u'auth',…
kuthue
  • 163
  • 1
  • 7
14
votes
1 answer

Modify Sqlite Table Column NOT NULL to NULL

I am looking for something similar to this but I'm using sqlite3. I have tried: sqlite> UPDATE JOBS SET JOB_TYPES = NULL; But I got "constraint failed". Am I doing it the correct way? I want to change the current "NOT NULL" to "NULL".
Sylar
  • 8,631
  • 20
  • 72
  • 139
14
votes
4 answers

C# sqlite query results to list

I'm struggling. I have query against my db that returns a single column of data and I need to set it as List. Here is what I am working with and I am getting an error about converting void to string. public static void GetImportedFileList() { …
Jake Sankey
  • 4,537
  • 12
  • 36
  • 52
14
votes
1 answer

How to make .sqliterc commands be quiet?

The .sqliterc file for sqlite3 is advised primarily for .this and .that -style dot-commands, like the ever-popular mysql output emulation: .header on .timer on .mode column However, you can put whatever SQL you want into .sqliterc. Once you…
IcarusNM
  • 821
  • 7
  • 15
14
votes
3 answers

sqlite3_prepare_v2 / sqlite3_exec

Few questions about sqlite3: 1.When is necessary to use first approach one and when the other ? It is a difference between them? sqlite3_prepare_v2(_contactDB, sql_stmt_getIdRecepteur, -1, &sqlStatement, NULL); and…
Developer3000
  • 197
  • 1
  • 1
  • 8
14
votes
2 answers

Convert string to int inside WHERE clause of SQLITE statment

I want to achieve this: SELECT * FROM linkledger WHERE toInt(reputation) > 100; but the function toInt doesnt exist? Is there one? I found this now but not working, which implies i have a more fundemental problem. BECAUSE THIS IS CORRECT SELECT *…
Banned_User
  • 837
  • 2
  • 9
  • 16
14
votes
5 answers

Python AttributeError: 'module' object has no attribute 'connect'

I'm trying to create a program with sqlite3 database using Ubuntu (Xubuntu 14.04) and the pre-installed version of Python. I tried if the first lines are working but there is already an error. I installed "python-sqlite" and "sqlite3". Can anyone…
mschoenwaelder
  • 143
  • 1
  • 1
  • 4
14
votes
3 answers

AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY - android

I'm trying to create a table in my DB with an ID that is autoincrement itself but whenever I try to add the AUTOINCREMENT keyword to my query it tells me that : AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY Here is my…
David Lasry
  • 1,229
  • 4
  • 24
  • 39
14
votes
1 answer

SQLite.net SQLiteFunction not working in Linq to SQL

I've created a handful of custom SQLite functions in C# using System.Data.SQLite.SQLiteFunction. It works great when using SQLiteDataAdapter to execute queries, it does not work, however, when using Linq to SQL I get errors stating that the function…
14
votes
2 answers

Appending Pandas dataframe to sqlite table by primary key

I want to append the Pandas dataframe to an existing table in a sqlite database called 'NewTable'. NewTable has three fields (ID, Name, Age) and ID is the primary key. My database connection: import sqlite3 DB='' conn = sqlite3.connect(DB) …
lmart999
  • 4,983
  • 6
  • 27
  • 33
14
votes
3 answers

Unit testing NHibernate w/ SQLite and DateTimeOffset mappings

Porting over an application to use NHibernate from a different ORM. I've started to put in place the ability to run our unit tests against an in memory SQLite database. This works on the first few batches of tests, but I just hit a snag. Our app…
bakasan
  • 2,152
  • 2
  • 24
  • 33
14
votes
1 answer

Sqlite Add Column into table at a certain position (Android)

This is the code that works for adding a column. mDb.execSQL("ALTER TABLE " + table_name + " ADD COLUMN " + column_name + " text"); My problem the column is created at the last position of the…
Tower Jimmy
  • 486
  • 1
  • 4
  • 15
14
votes
4 answers

Detected sqlite3 gem which is not supported on Heroku

I'm trying to push my rails app to Heroku, and I keep getting the following error: An error occurred while installing sqlite3 (1.3.8), and Bundler cannot continue. Make sure that `gem install sqlite3 -v '1.3.8'` succeeds before…
Katie H
  • 2,215
  • 5
  • 26
  • 47
1 2 3
99
100