Class PostgresOpenLineageLogStoreWriter
java.lang.Object
org.odpi.openmetadata.adapters.connectors.integration.openlineage.postgres.PostgresOpenLineageLogStoreWriter
PostgresOpenLineageLogStoreWriter issues the SQL that maintains one PostgreSQL OpenLineage log store: it creates
the schema and tables, stores each event with its contribution to the digest in one transaction, and purges old
records. Each call takes its own connection from the data source and returns it before it returns.
-
Constructor Summary
ConstructorsConstructorDescriptionPostgresOpenLineageLogStoreWriter(DataSource dataSource, PostgresOpenLineageLogStoreSchema schema) Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoidCreate the schema, its tables and indexes, if they do not exist.Delete the records older than a cut-off time in one transaction.booleanstore(PostgresOpenLineageEventDigest digest, String jsonEvent) Store an event and its contribution to the digest in one transaction.
-
Constructor Details
-
PostgresOpenLineageLogStoreWriter
public PostgresOpenLineageLogStoreWriter(DataSource dataSource, PostgresOpenLineageLogStoreSchema schema) Constructor- Parameters:
dataSource- source of pooled connections (auto-commit disabled)schema- definitions of the log store
-
-
Method Details
-
createSchema
Create the schema, its tables and indexes, if they do not exist.- Throws:
SQLException- problem with the database
-
store
Store an event and its contribution to the digest in one transaction. An event that is already stored (because it has been delivered twice) is skipped, so the digest counts it once.- Parameters:
digest- digest of the eventjsonEvent- event as JSON- Returns:
- true if the event was stored; false if it was already there
- Throws:
Exception- problem with the database or the event
-
purge
Delete the records older than a cut-off time in one transaction.- Parameters:
cutOff- records before this time are deleted- Returns:
- number of events, runs, assertions and tests deleted (in that order)
- Throws:
SQLException- problem with the database
-