---
description:
  Use GraphQL schema created by Tuql for SQLite databases or SQL dump files with GraphQL Mesh Tuql
  handler.
---

import { Callout } from '@theguild/components'

# SQLite

This handler allows you to use GraphQL schema created by [Tuql](https://github.com/bradleyboy/tuql),
based on an SQLite database schema or an SQL dump file.

To get started, install the handler library:

```sh npm2yarn
npm i @omnigraph/sqlite
```

## How to use?

Then you can import the library in your configuration file, and define your Tuql source;

```ts filename="mesh.config.ts" {2,7-9}
import { defineConfig } from '@graphql-mesh/compose-cli'
import { loadSQLiteSubgraph } from '@omnigraph/sqlite'

export const composeConfig = defineConfig({
  subgraphs: [
    {
      sourceHandler: loadSQLiteSubgraph('MyDb', {
        db: 'path/to/database.sqlite'
      })
    }
  ]
})
```

<Callout>
  [You can find a working example here](
  https://github.com/ardatan/graphql-mesh/tree/main/examples/v1-next/sqlite-chinook )
</Callout>

And also you can create an in-memory database using an SQL dump file;

```ts filename="mesh.config.ts" {8}
import { defineConfig } from '@graphql-mesh/compose-cli'
import { loadSQLiteSubgraph } from '@omnigraph/sqlite'

export const composeConfig = defineConfig({
  subgraphs: [
    {
      sourceHandler: loadSQLiteSubgraph('MyDb', {
        infile: 'path/to/db_dump.sql'
      })
    }
  ]
})
```
