SQLite cheatsheet

Count rows in the table

In this example a SQLite query is used to count the rows in the avatar table.

Count rows
Count rows
# count rows in a table
datasources:  
  row_count:
    type: datasource.sqlite
    options:
      provider: DATA_PROVIDER_DYNAMIC
  
      entities:
        - default/avatar
  
      query: |
        SELECT COUNT(*) AS row_count
        FROM [default/avatar] 

Converting dates

Here is an example of using a SQLite query to convert dates in a dynamic data table.

SQLite - Converting dates
SQLite - Converting dates

Joining data from tables and using subquery

Using a SQLite query, one can join data from different tables by utilizing subqueries. This allows for the combination of information from multiple tables based on specified conditions. By employing subqueries, one can retrieve and manipulate data ensuring accurate and comprehensive results. Below is an example of joining tables and then using a subquery.

Joining tables

Often you want to use data in your solution but the data is stored in different tables. Use a SQLite query to join the data from tables and extract the exact information you want to use. When joining two tables there must be the same identifier in both tables. In the example below both tables has a $.date column. Result: The result of the example below is date: 5 finished_date: 5.11

JSON array length

The query below provides the JSON array length from a table called battles.

Last updated

Was this helpful?