> For the complete documentation index, see [llms.txt](https://docs.octoxlabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.octoxlabs.com/adapters/s/sqlite.md).

# SQLite

This adapter reads devices from a table or view in a SQLite database file. It is useful for asset lists that exist only as an export. Columns named after the OctoXLabs global fields are mapped automatically.

## Use cases

* Bring in devices from an exported asset list.

```
Adapters = sqlite
```

* Find devices in the file that another source does not report.

```
Adapters = sqlite
```

## Before you begin

### Network

No network access is needed. The connector reads the database file from its local media folder.

### Required permissions

The connector user must be able to read the file in `/opt/octoxlabs/connector/media/sqlite`. The file is opened read-only. Files ending in -wal, -shm or -journal are ignored when the pattern is resolved.

## Create credentials in SQLite

{% stepper %}
{% step %}

### Prepare the database file

Export or build a SQLite database that holds the table or view to import. Name its columns after the OctoXLabs fields listed in the Fields fetched section.
{% endstep %}

{% step %}

### Copy the file to the connector

Copy the file to `/opt/octoxlabs/connector/media/sqlite` on the connector machine.
{% endstep %}

{% step %}

### Check permissions

Make sure the connector can read the file, then run the connection test.
{% endstep %}
{% endstepper %}

## Connection parameters

| Parameter      | Required    | Type | Default  | Description                                                                                                                               |
| -------------- | ----------- | ---- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| Filename       | Yes         | Text |          | Name of the SQLite database file, for example `inventory.db`. A pattern such as `*.sqlite` is accepted. The newest matching file is read. |
| View Name      | Conditional | Text |          | Table or view to read. Required unless Custom Query is set.                                                                               |
| Custom Query   | Conditional | Text |          | A single read-only SELECT or WITH query that replaces the view.                                                                           |
| Hostname Field | No          | Text | Hostname | Column that holds the device host name. It is used when the Hostname column is empty.                                                     |

## Troubleshooting

| Error message                        | Cause                                                | Fix                                                                                     |
| ------------------------------------ | ---------------------------------------------------- | --------------------------------------------------------------------------------------- |
| File not found with this pattern.    | No file in the sqlite media folder matches Filename. | Copy the file to `/opt/octoxlabs/connector/media/sqlite` and check the name or pattern. |
| Enter a view name or a custom query. | Neither View Name nor Custom Query is set.           | Fill in one of them.                                                                    |

## Change history

{% hint style="info" %}
Available starting from version 6.9.1.
{% endhint %}
