From bec15d5c829838ebd8d95f93e9e38aa3228dafc0 Mon Sep 17 00:00:00 2001 From: Rounak Dhillon <162090200+RounakDhillon@users.noreply.github.com> Date: Mon, 17 Mar 2025 16:44:27 +0530 Subject: [PATCH] Docs: PostgresSQL Doc Updation (#20296) Co-authored-by: Rounak Dhillon --- .../v1.6.x/connectors/database/postgres/index.md | 13 ++++++++++--- .../connectors/database/postgres/index.md | 16 +++++++++++----- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/openmetadata-docs/content/v1.6.x/connectors/database/postgres/index.md b/openmetadata-docs/content/v1.6.x/connectors/database/postgres/index.md index 5219a9ea8b6..f76a522b040 100644 --- a/openmetadata-docs/content/v1.6.x/connectors/database/postgres/index.md +++ b/openmetadata-docs/content/v1.6.x/connectors/database/postgres/index.md @@ -53,26 +53,33 @@ Then, when extracting usage and lineage data, the query log duration will have n ```sql GRANT pg_read_all_stats TO your_user; ``` + ## Stored Procedures When executing stored procedures in PostgreSQL, lineage extraction relies on capturing the SQL queries executed within the procedure. However, by default, PostgreSQL does not track the internal queries of a stored procedure in `pg_stat_statements`. ### Enabling Query Tracking for Lineage + To ensure OpenMetadata captures lineage from stored procedures, follow these steps: 1. **Enable Logging for All Statements**    Modify the `postgresql.conf` file and set: +    ```ini    log_statement = 'all'    ``` -   This will log all executed SQL statements, including those inside stored procedures. + + This will log all executed SQL statements, including those inside stored procedures. 2. **Configure `pg_stat_statements` to Track Nested Queries** -   By default, `pg_stat_statements` may only capture top-level procedure calls and not the internal queries. To change this behavior, update: +    +By default, `pg_stat_statements` may only capture top-level procedure calls and not the internal queries. To change this behavior, update: +    ```ini    pg_stat_statements.track = 'all'    ``` -   This ensures that statements executed within procedures are recorded. + +This ensures that statements executed within procedures are recorded. ## Metadata Ingestion diff --git a/openmetadata-docs/content/v1.7.x-SNAPSHOT/connectors/database/postgres/index.md b/openmetadata-docs/content/v1.7.x-SNAPSHOT/connectors/database/postgres/index.md index 8d718f06269..9fde79bc909 100644 --- a/openmetadata-docs/content/v1.7.x-SNAPSHOT/connectors/database/postgres/index.md +++ b/openmetadata-docs/content/v1.7.x-SNAPSHOT/connectors/database/postgres/index.md @@ -54,26 +54,32 @@ Then, when extracting usage and lineage data, the query log duration will have n GRANT pg_read_all_stats TO your_user; ``` -## Capturing Lineage for Stored Procedures in PostgreSQL +## Stored Procedures When executing stored procedures in PostgreSQL, lineage extraction relies on capturing the SQL queries executed within the procedure. However, by default, PostgreSQL does not track the internal queries of a stored procedure in `pg_stat_statements`. ### Enabling Query Tracking for Lineage + To ensure OpenMetadata captures lineage from stored procedures, follow these steps: 1. **Enable Logging for All Statements** -   Modify the `postgresql.conf` file and set: + +Modify the `postgresql.conf` file and set:    ```ini    log_statement = 'all'    ``` -   This will log all executed SQL statements, including those inside stored procedures. + + This will log all executed SQL statements, including those inside stored procedures. 2. **Configure `pg_stat_statements` to Track Nested Queries** -   By default, `pg_stat_statements` may only capture top-level procedure calls and not the internal queries. To change this behavior, update: + +By default, `pg_stat_statements` may only capture top-level procedure calls and not the internal queries. To change this behavior, update: +    ```ini    pg_stat_statements.track = 'all'    ``` -   This ensures that statements executed within procedures are recorded. + +This ensures that statements executed within procedures are recorded. ## Metadata Ingestion