Skip to content

Commit

Permalink
Merge branch 'main' into ISSUE-8428
Browse files Browse the repository at this point in the history
  • Loading branch information
TeddyCr authored Sep 14, 2024
2 parents 9b159b7 + 15a6b4b commit 64bd8e7
Show file tree
Hide file tree
Showing 110 changed files with 4,172 additions and 3,288 deletions.
5 changes: 4 additions & 1 deletion ingestion/src/metadata/ingestion/ometa/mixins/es_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ class HitsModel(BaseModel):
"""Elasticsearch hits model"""

index: Annotated[str, Field(description="Index name", alias="_index")]
type: Annotated[str, Field(description="Type of the document", alias="_type")]
type: Annotated[
Optional[str],
Field(default=None, description="Type of the document", alias="_type"),
]
id: Annotated[str, Field(description="Document ID", alias="_id")]
score: Annotated[
Optional[float], Field(description="Score of the document", alias="_score")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from functools import partial
from typing import Optional

from google.api_core.exceptions import NotFound
from google.cloud.datacatalog_v1 import PolicyTagManagerClient
from sqlalchemy.engine import Engine

Expand Down Expand Up @@ -149,8 +150,8 @@ def test_connection_inner(engine):
test_fn = {
"CheckAccess": partial(test_connection_engine_step, engine),
"GetSchemas": partial(execute_inspector_func, engine, "get_schema_names"),
"GetTables": partial(execute_inspector_func, engine, "get_table_names"),
"GetViews": partial(execute_inspector_func, engine, "get_view_names"),
"GetTables": partial(get_table_view_names, engine),
"GetViews": partial(get_table_view_names, engine),
"GetTags": test_tags,
"GetQueries": partial(
test_query,
Expand All @@ -170,3 +171,28 @@ def test_connection_inner(engine):
)

test_connection_inner(engine)


def get_table_view_names(connection, schema=None):
with connection.connect() as conn:
current_schema = schema
client = conn.connection._client
item_types = ["TABLE", "EXTERNAL", "VIEW", "MATERIALIZED_VIEW"]
datasets = client.list_datasets()
result = []
for dataset in datasets:
if current_schema is not None and current_schema != dataset.dataset_id:
continue

try:
tables = client.list_tables(dataset.reference, page_size=1)
for table in tables:
if table.table_type in item_types:
break
except NotFound:
# It's possible that the dataset was deleted between when we
# fetched the list of datasets and when we try to list the
# tables from it. See:
# https://github.com/googleapis/python-bigquery-sqlalchemy/issues/105
pass
return result
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from typing import Optional

from sqlalchemy.engine import Engine
from sqlalchemy.sql import text

from metadata.generated.schema.entity.automations.workflow import (
Workflow as AutomationWorkflow,
Expand All @@ -38,6 +39,7 @@
from metadata.ingestion.ometa.ometa_api import OpenMetadata
from metadata.ingestion.source.connections import kill_active_connections
from metadata.ingestion.source.database.redshift.queries import (
REDSHIFT_GET_ALL_RELATIONS,
REDSHIFT_GET_DATABASE_NAMES,
REDSHIFT_TEST_GET_QUERIES,
REDSHIFT_TEST_PARTITION_DETAILS,
Expand Down Expand Up @@ -65,6 +67,11 @@ def test_connection(
Test connection. This can be executed either as part
of a metadata workflow or during an Automation Workflow
"""
table_and_view_query = text(
REDSHIFT_GET_ALL_RELATIONS.format(
schema_clause="", table_clause="", limit_clause="LIMIT 1"
)
)

def test_get_queries_permissions(engine_: Engine):
"""Check if we have the right permissions to list queries"""
Expand All @@ -78,8 +85,8 @@ def test_get_queries_permissions(engine_: Engine):
test_fn = {
"CheckAccess": partial(test_connection_engine_step, engine),
"GetSchemas": partial(execute_inspector_func, engine, "get_schema_names"),
"GetTables": partial(execute_inspector_func, engine, "get_table_names"),
"GetViews": partial(execute_inspector_func, engine, "get_view_names"),
"GetTables": partial(test_query, statement=table_and_view_query, engine=engine),
"GetViews": partial(test_query, statement=table_and_view_query, engine=engine),
"GetQueries": partial(test_get_queries_permissions, engine),
"GetDatabases": partial(
test_query, statement=REDSHIFT_GET_DATABASE_NAMES, engine=engine
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@
# hence we are appending "create view <schema>.<table> as " to select query
# to generate the column level lineage
REDSHIFT_GET_ALL_RELATIONS = """
SELECT
(SELECT
c.relkind,
n.oid as "schema_oid",
n.nspname as "schema",
Expand All @@ -255,8 +255,9 @@
JOIN pg_catalog.pg_user u ON u.usesysid = c.relowner
WHERE c.relkind IN ('r', 'v', 'm', 'S', 'f')
AND n.nspname !~ '^pg_' {schema_clause} {table_clause}
{limit_clause})
UNION
SELECT
(SELECT
'r' AS "relkind",
s.esoid AS "schema_oid",
s.schemaname AS "schema",
Expand All @@ -272,7 +273,8 @@
JOIN svv_external_schemas s ON s.schemaname = t.schemaname
JOIN pg_catalog.pg_user u ON u.usesysid = s.esowner
where 1 {schema_clause} {table_clause}
ORDER BY "relkind", "schema_oid", "schema";
ORDER BY "relkind", "schema_oid", "schema"
{limit_clause});
"""


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ def _get_all_relation_info(self, connection, **kw): # pylint: disable=unused-ar
result = connection.execute(
sa.text(
REDSHIFT_GET_ALL_RELATIONS.format(
schema_clause=schema_clause, table_clause=table_clause
schema_clause=schema_clause, table_clause=table_clause, limit_clause=""
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
SNOWFLAKE_TEST_FETCH_TAG,
SNOWFLAKE_TEST_GET_QUERIES,
SNOWFLAKE_TEST_GET_TABLES,
SNOWFLAKE_TEST_GET_VIEWS,
)
from metadata.utils.logger import ingestion_logger

Expand Down Expand Up @@ -176,7 +177,11 @@ def test_connection(
statement=SNOWFLAKE_TEST_GET_TABLES,
engine_wrapper=engine_wrapper,
),
"GetViews": partial(execute_inspector_func, engine_wrapper, "get_view_names"),
"GetViews": partial(
test_table_query,
statement=SNOWFLAKE_TEST_GET_VIEWS,
engine_wrapper=engine_wrapper,
),
"GetQueries": partial(
test_query, statement=SNOWFLAKE_TEST_GET_QUERIES, engine=engine
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@
SELECT TABLE_NAME FROM "{database_name}".information_schema.tables LIMIT 1
"""

SNOWFLAKE_TEST_GET_VIEWS = """
SELECT TABLE_NAME FROM "{database_name}".information_schema.views LIMIT 1
"""

SNOWFLAKE_GET_DATABASES = "SHOW DATABASES"


Expand Down
132 changes: 81 additions & 51 deletions openmetadata-docs/content/v1.5.x/collate-menu.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,27 @@ site_menu:
- category: Home
url: /

- category: Enable Security
url: /security
- category: Getting Started
url: /getting-started
color: violet-70
icon: deployment

- category: Enable Security / Basic Authentication
url: /security/basic-auth
- category: Enable Security / Ldap Authentication
url: /security/ldap
- category: Enable Security / Auth0 SSO
url: /security/auth0
- category: Enable Security / Azure SSO
url: /security/azure
- category: Enable Security / Custom OIDC SSO
url: /security/custom-oidc
- category: Enable Security / OIDC SSO
url: /security/oidc
- category: Enable Security / Google SSO
url: /security/google
- category: Enable Security / Okta SSO
url: /security/okta
- category: Enable Security / Amazon Cognito SSO
url: /security/amazon-cognito
- category: Enable Security / One Login SSO
url: /security/one-login
- category: Enable Security / Keycloak SSO
url: /security/keycloak
- category: Enable Security / Saml
url: /security/saml
- category: Enable Security / Saml / AWS
url: /security/saml/aws
- category: Enable Security / Saml / Azure
url: /security/saml/azure
icon: openmetadata

- category: Getting Started / Day 1
url: /getting-started/day-1
- category: Getting Started / Day 1 / Collate SaaS
url: /getting-started/day-1/collate-saas
- category: Getting Started / Day 1 / Hybrid SaaS
url: /getting-started/day-1/hybrid-saas
- category: Getting Started / Day 1 / Hybrid SaaS / Airflow
url: /getting-started/day-1/hybrid-saas/airflow
- category: Getting Started / Day 1 / Hybrid SaaS / MWAA
url: /getting-started/day-1/hybrid-saas/mwaa
- category: Getting Started / Day 1 / Hybrid SaaS / GCS Composer
url: /getting-started/day-1/hybrid-saas/gcs-composer
- category: Getting Started / Day 1 / Hybrid SaaS / GitHub Actions
url: /getting-started/day-1/hybrid-saas/github-actions
- category: Getting Started / Day 1 / Hybrid SaaS / Credentials
url: /getting-started/day-1/hybrid-saas/credentials

- category: Connectors
url: /connectors
Expand Down Expand Up @@ -718,27 +706,41 @@ site_menu:
url: /how-to-guides/data-governance/domains-&-data-products/domains
- category: How-to Guides / Data Governance / Domains & Data Product / How to Use Data Products
url: /how-to-guides/data-governance/domains-&-data-products/data-products
- category: Getting Started
url: /getting-started

- category: Enable Security
url: /security
color: violet-70
icon: openmetadata

- category: Getting Started / Day 1
url: /getting-started/day-1
- category: Getting Started / Day 1 / Hybrid SaaS
url: /getting-started/day-1/hybrid-saas
- category: Getting Started / Day 1 / Hybrid SaaS / Airflow
url: /getting-started/day-1/hybrid-saas/airflow
- category: Getting Started / Day 1 / Hybrid SaaS / MWAA
url: /getting-started/day-1/hybrid-saas/mwaa
- category: Getting Started / Day 1 / Hybrid SaaS / GCS Composer
url: /getting-started/day-1/hybrid-saas/gcs-composer
- category: Getting Started / Day 1 / Hybrid SaaS / GitHub Actions
url: /getting-started/day-1/hybrid-saas/github-actions
- category: Getting Started / Day 1 / Hybrid SaaS / Credentials
url: /getting-started/day-1/hybrid-saas/credentials
icon: deployment

- category: Enable Security / Basic Authentication
url: /security/basic-auth
- category: Enable Security / Ldap Authentication
url: /security/ldap
- category: Enable Security / Auth0 SSO
url: /security/auth0
- category: Enable Security / Azure SSO
url: /security/azure
- category: Enable Security / Custom OIDC SSO
url: /security/custom-oidc
- category: Enable Security / OIDC SSO
url: /security/oidc
- category: Enable Security / Google SSO
url: /security/google
- category: Enable Security / Okta SSO
url: /security/okta
- category: Enable Security / Amazon Cognito SSO
url: /security/amazon-cognito
- category: Enable Security / One Login SSO
url: /security/one-login
- category: Enable Security / Keycloak SSO
url: /security/keycloak
- category: Enable Security / Saml
url: /security/saml
- category: Enable Security / Saml / AWS
url: /security/saml/aws
- category: Enable Security / Saml / Azure
url: /security/saml/azure

- category: Releases
url: /releases
color: violet-70
Expand All @@ -749,6 +751,34 @@ site_menu:
url: /releases/supported
- category: Releases / All Releases
url: /releases/all-releases
- category: Releases / All Releases / 1.5.2 Release
url: /releases/all-releases/#1.5.2-release
- category: Releases / All Releases / 1.5.1 Release
url: /releases/all-releases/#1.5.1-release
- category: Releases / All Releases / 1.4.8 Release
url: /releases/all-releases/#1.4.8-release
- category: Releases / All Releases / 1.4.7 Release
url: /releases/all-releases/#1.4.7-release
- category: Releases / All Releases / 1.4.6 Release
url: /releases/all-releases/#1.4.6-release
- category: Releases / All Releases / 1.4.5 Release
url: /releases/all-releases/#1.4.5-release
- category: Releases / All Releases / 1.4.4 Release
url: /releases/all-releases/#1.4.4-release
- category: Releases / All Releases / 1.4.3 Release
url: /releases/all-releases/#1.4.3-release
- category: Releases / All Releases / 1.4.2 Release
url: /releases/all-releases/#1.4.2-release
- category: Releases / All Releases / 1.4.1 Release
url: /releases/all-releases/#1.4.1-release
- category: Releases / All Releases / 1.4.0 Release
url: /releases/all-releases/#1.4.0-release
- category: Releases / All Releases / 1.3.4 Release
url: /releases/all-releases/#1.3.4-release
- category: Releases / All Releases / 1.3.3 Release
url: /releases/all-releases/#1.3.3-release
- category: Releases / All Releases / 1.3.2 Release
url: /releases/all-releases/#1.3.2-release
- category: Releases / All Releases / 1.3.1 Release
url: /releases/all-releases/#1.3.1-release
- category: Releases / All Releases / 1.3.0 Release
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
title: Collate SaaS
slug: /getting-started/day-1/collate-saas
collate: true
---

## Setting Up a Database Service for Metadata Extraction

You can easily set up a database service for metadata extraction from Collate SaaS in just a few minutes. For example, here’s how to set up a connection using the `Snowflake` Connector:

1. Log in to your Collate SaaS instance, then navigate to **Settings > Services > Databases** & Click on Add New Service.

{% image
src="/images/v1.5/getting-started/add-service.png"
alt="Adding Database Service"
height="500px"
caption="Adding Database Service" /%}

2. **Select the database type** you want to use. Enter details such as the name and description to identify the database. In this Case we are selecting `Snowflake`.

{% image
src="/images/v1.5/getting-started/select-service.png"
alt="Selecting Database Service"
height="850px"
caption="Selecting Database Service" /%}

4. **Enter the Connection Details** You can view the available documentation in the side panel for guidance. Also, refer to the connector [documentation](/connectors).

{% image
src="/images/v1.5/getting-started/configure-connector.png"
alt="Updating Connection Details"
height="950px"
caption="Updating Connection Details" /%}

5. **Allow the Collate SaaS IP**. In the Connection Details, you will see the IP Address unique to your cluster, You need to Allow the `IP` to Access the datasource.


{% note %}
This step is required only for Collate SaaS. If you are using Hybrid SaaS, you will not see the IP address in the Service Connection details.
{% /note %}

{% image
src="/images/v1.5/getting-started/collate-saas-ip.png"
alt="Collate SaaS IP"
height="200px"
caption="Collate SaaS IP" /%}

6. **Test the connection** to verify the status. The test connection will check if the Service is reachable from Collate.

{% image
src="/images/v1.5/getting-started/test-connection.png"
alt="Verifying the Test Connection"
height="350px"
caption="Verifying the Test Connection" /%}
Loading

0 comments on commit 64bd8e7

Please sign in to comment.