> For the complete documentation index, see [llms.txt](https://datasherlock.gitbook.io/datasherlock/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://datasherlock.gitbook.io/datasherlock/introductions/databases.md).

# Databases

Learn how to configure Datasherlock for your specific needs. This guide provides insights into setting up your Datasherlock instance with all major sql databases

### Database Configurations <a href="#database-configuration" id="database-configuration"></a>

Datasherlock offers support for all major databases. Choose the database type that suits your application's requirements and configure it accordingly.

{% tabs %}
{% tab title="MySQL" %}

### Configuration <a href="#configuration-options" id="configuration-options"></a>

```
type: "mysql"
database:
  host: "<DB_HOST>"
  username: "<DB_USERNAME>"
  port: "<DB_PORT>"
  database: "<DB_NAME>"
  ssl: "<DB_SSL>" 
```

### Configuration Options <a href="#configuration-options" id="configuration-options"></a>

* `host` : Your database host URL
* `username` : Your Database Username
* `port` : Your Database Password, default 3306
* `database` : "Your Database name"
* `ssl` : "SSL is enabled or disable (true, false)"
  {% endtab %}

{% tab title="PostgresSQL" %}

### Configuration <a href="#configuration-options" id="configuration-options"></a>

```
type: "postgres"
database:
  host: "<DB_HOST>"
  username: "<DB_USERNAME>"
  port: "<DB_PORT>"
  database: "<DB_NAME>"
  ssl: "<DB_SSL>" 
```

### Configuration Options <a href="#configuration-options" id="configuration-options"></a>

* `host` : Your database host URL
* `username` : Your Database Username
* `port` : Your Database Password, default 5432
* `database` : "Your Database name"
* `ssl` : "SSL is enabled or disable (enable, disable)"
  {% endtab %}

{% tab title="BigQuery" %}

### Configuration <a href="#configuration-options" id="configuration-options"></a>

```
type: "bigquery"
database:
  database: "<DB_NAME>"
  project_id: "<GCP_PROJECT_ID>" 
```

### Configuration Options <a href="#configuration-options" id="configuration-options"></a>

* `database` : "Your Database name"
* `project_id` : GCP Project id
  {% endtab %}

{% tab title="SnowFlake" %}

### Configuration <a href="#configuration-options" id="configuration-options"></a>

```
type: "snowflake"
database:
  database: "<DB_NAME>"
  username: "<SNOWFLAKE_USERNAME>"
  account: "<SNOW_FLAKE_ACCOUNT>"
  warehouse: "<SNOW_FLAKE_WAREHOUSE>"
  schema: "<SNOW_FLAKE_SCHEMA>"
```

### Configuration Options <a href="#configuration-options" id="configuration-options"></a>

* `database` : "Your Database name"
* `account` : "Only used for snowflake account"
* `warehouse` : "Only used for snowflake warehouse"
* `schema` : "Only used for snowflake schema name"
* `username` : Your Database Username
  {% endtab %}

{% tab title="MsSQL" %}

### Configuration <a href="#configuration-options" id="configuration-options"></a>

```
type: "mssql"
database:
  host: "<DB_HOST>"
  username: "<DB_USERNAME>"
  port: "<DB_PORT>"
  database: "<DB_NAME>"
```

### Configuration Options <a href="#configuration-options" id="configuration-options"></a>

* `host` : Your database host URL
* `username` : Your Database Username
* `port` : Your Database Password, default 3306
* `database` : "Your Database name"
  {% endtab %}

{% tab title="Redshift" %}

### Configuration <a href="#configuration-options" id="configuration-options"></a>

```
type: "redshift"
database:
  host: "<DB_HOST>"
  username: "<DB_USERNAME>"
  port: "<DB_PORT>"
  database: "<DB_NAME>"
  ssl: "<DB_SSL>" 
```

### Configuration Options <a href="#configuration-options" id="configuration-options"></a>

* `host` : Your database host URL
* `username` : Your Database Username
* `port` : Your Database Password, default 443
* `database` : "Your Database name"
  {% endtab %}
  {% endtabs %}

### Create Agent <a href="#database-configuration" id="database-configuration"></a>

<figure><img src="/files/YkZWIU3kXeXKrwEv7g0V" alt=""><figcaption></figcaption></figure>

**NOTE:** On Catalog page will will see API Keys, Each API keys are tightly coupled with agent.&#x20;

### Export Environments  variables <a href="#export-env-variables" id="export-env-variables"></a>

<pre class="language-bash"><code class="lang-bash">export DS_API_KEY=****
<strong>export DB_PASSWORD=college
</strong><strong>
</strong>export GOOGLE_APPLICATION_CREDENTIALS=&#x3C;PATH TO GCP CREDENTIALS> // Only required for bigquery
</code></pre>

### Register Database Metadata in the Cloud <a href="#register-database-metadata-in-the-cloud" id="register-database-metadata-in-the-cloud"></a>

To connect your agent to the Datasherlock cloud, use the following command. It will register your database schema with cloud

```bash
sherlock register --config config.yaml -n <AGENT_NAME>
```

### Run an Agent Locally <a href="#run-an-agent-locally" id="run-an-agent-locally"></a>

To run an API server locally on port 8080, use the following command. You can then use this URL to interact with the platform:

```bash
sherlock serve --config config.yaml
```
