Questions tagged [sqldelight]

SQLDelight generates Java models from your SQL statements. These models give you a typesafe API to read & write the rows of your tables. It helps you to keep your SQL statements together, organized, and easy to access from Java.

SQLDelight generates typesafe APIs from your SQL statements. It compile-time verifies your schema, statements, and migrations and provides IDE features like autocomplete and refactoring which make writing and maintaining SQL simple. SQLDelight currently supports the SQLite dialect and there are supported SQLite drivers on Android, JVM and iOS.

The premise of SQLDelight is unchanged: Write SQLite and let the Gradle plugin generate APIs to run your queries for you. SQLDelight files use the .sq extensions and are contained in your src/main/sqldelight folder in a Gradle module.

122 questions
3
votes
1 answer

SQLDelight plugin errors

IDE (Android Studio) not show errors (eg. duplicate tables), cannot go to reference method when click+command; it's a little bit weird because at first plugin was working like a charm for like two weeks, suddenly stop working. Android Studio…
Erick
  • 270
  • 3
  • 5
3
votes
4 answers

Is it possible to load a pre-populated database from local resource using sqldelight

I have a relatively large db that may take 1 to 2 minutes to initialise, is it possible to load a pre-populated db when using sqldelight (kotlin multiplatform) instead of initialising the db on app launch?
3
votes
1 answer

How to do bulk insertion in square sqldelight?

Thanks square for SQLDelight and providing typesafe api's for sqlite db interactions. I am doing single insert row as below: MyTable.Insert_row insert_row = new MyTableModel.Insert_row( mOpenHelper.getWritableDatabase(), …
nishant pathak
  • 342
  • 1
  • 4
  • 17
3
votes
1 answer

How to use new compiled statements in sqldelight with sqlbrite?

Since I cannot obtain SQLiteOpenHelper instance from BriteDatabase, how can I create compiled insert/update/delete statement from my model? Methods that return SqlDelightStatement are marked as deprecated in SqlDelight 0.5.1. I'm using SqlBrite…
Alexander Perfilyev
  • 6,739
  • 2
  • 17
  • 30
2
votes
1 answer

How do I iterate over SqlDelight select results without loading everything into memory?

As far as I can see SqlDelight Query object doesn't have any way to query items one by one instead of everything as a whole like executeAsList(). I have a large table to process and I can't load everything into memory. The execute() function comes…
Grzegorz Adam Hankiewicz
  • 7,349
  • 1
  • 36
  • 78
2
votes
0 answers

SQLDelight migrate from ready-made database

Help understand. I have an old project written in Java, which uses a ready-made database in the form of a .db file Decided to switch to KMM using SQLDelight. But, don't know how to migrate from the old database. In the plan, if this is a new user,…
user238664
  • 33
  • 4
2
votes
1 answer

SqlDelight KMM app where is the generated SQL database located

I have a KMM app for iOS/Android where I am using SQLDelight (1.5.3). I would like to find the generated DB file (maybe .SQLite) and open it to see the content. (maybe using DB Browser in SQLite). I am able to find the file through Xcode, but not…
Zsolt
  • 3,648
  • 3
  • 32
  • 47
2
votes
0 answers

How recover context from androidMain module of Kotlin Multiplatform proyect

I was developing an app where I try to implement a SQLDelight database, in order to I have to create a internal actual function where I keep the cache of the app. But my problems cames when I try to configurate to AndroidMain module, due to the…
Manuel Lucas
  • 636
  • 6
  • 17
2
votes
1 answer

What are the limitations of using SQLDelight in KMM (prod)

SQLDelight is still marked as experimental library on maven repository here, though the first version seems to be released in October 2018. I made a sample app in KMM where I'm able to insert/delete rows, and it seems to be working fine for our use…
2
votes
0 answers

Specifying initial database version when using SQLDelight

We're migrating from the Android platform SQLiteDatabase/SQLiteOpenHelper to use SQLDelight. Our first public database version was 17. By default, the SQLDelight Schema returns 1 for version. The only way I've been able to find to force version to…
ashughes
  • 7,155
  • 9
  • 48
  • 54
2
votes
0 answers

Android SQLDelight - "NOT NULL constraint failed" on a field that is not nullable

Basically as the title says. I have a UUID field which is declared NOT NULL: sheet_id TEXT AS UUID NOT NULL, The field is mapped from a non-nullable field in our model class: val sheetId: UUID, But there has been a non-trivial number of Non-fatal…
qtfw
  • 31
  • 3
2
votes
1 answer

Where to find database file for iOS tests

I've set up my tests to the native driver for iOS. However, I've noticed some issues with the iOS database not being fully torn-down between my tests and want to delete the file if possible to give a clean start, but I don't actually know where it…
2
votes
1 answer

SqlDelight, MySql, and Flow: Flow's collect lambda not invoked on database changes

I'm playing around with SqlDelight using MySql with Hikary datasource in a plain JVM project using Kotlin and Flow to consume queries results. The first execution of a query returns the data as expected, however the Flow#emit() is not triggered when…
Paolo
  • 515
  • 5
  • 9
2
votes
0 answers

no such table while inserting data in SQLDelight

All of a sudden my sample project is unable to insert data to table. it complains table not created. my sample GitHub(https://github.com/sreexamus/KMMSQLDelightPOC) removed the SQM file in the sample and tried. Not sure which plugin got updated on…
SreekanthI
  • 393
  • 3
  • 13
2
votes
1 answer

How to change primary key of table in SQLDelight?

We are working on some project where we have SQLDelight database and DBRevisionPhrase table: CREATE TABLE DbRevisionPhrase ( userId TEXT NOT NULL, phraseId TEXT NOT NULL, vocabularyId TEXT NOT NULL, isMissed INTEGER AS Boolean NOT…
1 2
3
8 9