# Connection

{% hint style="info" %}

{% endhint %}

x

{% tabs %}
{% tab title="Snowflake" %}
x

x

{% tabs %}
{% tab title="Prerequisites" %}
{% hint style="info" %}
As a superuser, execute the following SQL commands to create a read-only role, a user (e.g. SVC\_PDQ) assigned to that role, and a warehouse for that role. PDQ fetches the metadata from the .INFORMATION\_SCHEMA, usage grant on the database should provide permissions to read INFORMATION\_SCHEMA for the service account role.

We also need access to Snowﬂake Metadata to Fetch Query Counts on the data assets and this is pulled from SNOWFLAKE.ACCOUNT\_USAGE. Provide the following access for that “READ ONLY” service account role that is assigned to the PDQ service account:&#x20;

● grant "USAGE" access on the database&#x20;

● grant "USAGE" access on schemas&#x20;

● grant "USAGE" access on the warehouse&#x20;

● grant "Select" access on all tables in the Schema/Database that is deﬁned in PDQ Snowﬂake Connection&#x20;

● grant "Select" access on Snowﬂake metadata for usage information.&#x20;
{% endhint %}

In the below query, replace the names accordingly and run for each Schema:

```sql
-- Read-only access to specific schemas and warehouse (CHANGE THIS) 
set schema_name = 'DATABASE_NAME.SCHEMA_NAME'; 
set warehouse_name = 'WAREHOUSE_NAME';
```

```sql
grant USAGE on database identifier($database_name) to role identifier($PDQ_ROLE);
grant USAGE on schema identifier($schema_name) to role identifier($PDQ_ROLE);
```

```sql
grant USAGE on warehouse identifier($warehouse_name) to role identifier($PDQ_ROLE); 
grant SELECT on all tables in schema identifier($schema_name) to role identifier($PDQ_ROLE); 
grant SELECT on future tables in schema identifier($schema_name) to role identifier($PDQ_ROLE); 
grant SELECT on all views in schema identifier($schema_name) to role identifier($PDQ_ROLE); 
grant SELECT on future views in schema identifier($schema_name) to role identifier($PDQ_ROLE);
grant imported privileges on database snowflake to $PDQ_ROLE
```

{% endtab %}

{% tab title="Key-based Authentication" %}
{% hint style="info" %}
The user can generate either an encrypted or an unencrypted version of the private key. PDQ suggests using an encrypted version for security.
{% endhint %}

1. Generate the private key.

```bash
openssl genrsa 2048 | openssl pkcs8 -topk8 -v2 des3 -inform PEM -out
rsa_key.p8
```

2. Generate a Public key (reference the private key).

```bash
openssl rsa -in rsa_key.p8 -pubout -out rsa_key.pub
```

x

x
{% endtab %}

{% tab title="Snowflake Metadata Collection" %}
{% hint style="info" %}
Snowﬂake Collects Metadata in each Database instance inside INFORMATION\_SCHEMA and exposes the necessary metadata for the following objects.
{% endhint %}

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

{% hint style="info" %}
Snowﬂake also exposes a shared database called “SNOWFLAKE” that also presents the following schemas.
{% endhint %}

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

x

x

{% hint style="info" %}
PDQ depends on both INFORMATION\_SCHEMA for data proﬁling and ACCOUNT\_USAGE in the Snowﬂake shared database for usage information to provide insights into queries that are getting kicked off on the data assets, extraction of semantic terms like TAGS and POLICIES.&#x20;

PDQ has also added Snowﬂake Pipeline observability into the product and will require additional access to Tasks, Snowpipe along with Warehouse metering history for Cost Ops.
{% endhint %}

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

x
{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="MSSQL" %}

{% endtab %}

{% tab title="Oracle" %}

{% endtab %}
{% endtabs %}


---

# 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://academy.pentaho.com/data-quality-en/pentaho-data-quality/pdq-settings/connection.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.
