Skip to main content
Community Hub
TL;DR

Learn how to mine query history from PostgreSQL to generate lineage and usage metrics.

Your AI can read this via Docs MCPcurl -fsSL "https://docs.atlan.com/install-docs-mcp" | bashConnect

PostgreSQL miner app

The PostgreSQL miner app mines query history from PostgreSQL to generate lineage and usage metrics. Build it with the PostgresMiner builder.

A miner does not create a connection or take a credential—it runs on an existing PostgreSQL connection and reuses that connection's own credential, so you only supply the connection's qualifiedName.

Source extraction​

Mine query history from PostgreSQL
from pyatlan.client.atlan import AtlanClient
from pyatlan.model.apps import PostgresMiner

client = AtlanClient()

response = (
PostgresMiner(client)
.connection( # (1)
qualified_name="default/postgres/1700000000",
)
.run(name="postgres-prod-miner") # (2)
)
print(response.slug, response.run_id)
  1. Required. The exact qualifiedName of the existing PostgreSQL connection to mine. The builder resolves that connection's credential automatically—no credential step is needed.
  2. Always pass an explicit name for miners. A miner has no connection display name to derive one from, so a bare .run() defaults the workflow name to the app id (postgres-miner) and a second run collides (409 already exists).
Was this page helpful?