> 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-source-codes.md).

# SQLite Source Codes

This adapter reads source code repositories from a table or view in a SQLite database file.

## Use cases

* List repositories recorded in an exported file.

```
Adapters = sqlite-source-codes
```

* Review repositories that come from the file source.

```
Adapters = sqlite-source-codes
```

## 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 Source Codes

{% 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.                                                                           |
| Primary Key Field | No          | Text | PrimaryKey | Column that holds the unique identifier of each row.                                                                                      |

## 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 %}
