# 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="https://3853050875-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FP205EUdPJUmuNBngqIWg%2Fuploads%2FttwXWpiDVxEcsTx8DOvb%2FCreate.gif?alt=media&#x26;token=78b98443-fd5b-4956-84b1-21c9cb804d55" 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
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://datasherlock.gitbook.io/datasherlock/introductions/databases.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
