
Transaction Ledger
Transaction Ledger
Data Contract Template
Data Contract Template
Ensure transactional ledger data is fresh, complete, and reliable before it’s used for financial reporting, reconciliation, and downstream systems.
Data contract description
This data contract enforces schema stability, a 24-hour freshness SLA, and the presence of required transaction identifiers, account references, and timestamps. It prevents missing, duplicate, or invalid records, validates controlled formats such as currencies and transaction types, and applies core financial consistency rules on transaction amounts and statuses. Together, these checks help ensure the ledger remains accurate, auditable, and safe to use for balances, regulatory reporting, analytics, and customer-facing applications.
finance_transactions_data_contract.yml
datasetchecks: - schema: allow_extra_columns: false allow_other_column_order: false - row_count: threshold: must_be_greater_than: 0 - freshness: column: transaction_timestamp threshold: unit: hour must_be_less_than_or_equal: 24 - failed_rows: name: "Transaction timestamp must not be in the future" qualifier: ts_not_future expression: transaction_timestamp > ${soda.NOW} - failed_rows: name: "Amount sign must match transaction_type (DEBIT negative, CREDIT positive)" qualifier: amount_sign_by_type expression: > (transaction_type = 'DEBIT' AND amount >= 0) OR (transaction_type = 'CREDIT' AND amount <= 0)
columns: - name: transaction_id data_type: varchar checks: - missing: - duplicate: - invalid: name: "transaction_id must be a UUID" valid_format: name: UUID regex: "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$" - name: account_id data_type: varchar checks: - missing: - invalid: name: "account_id must be non-empty and sane length" valid_min_length: 1 valid_max_length: 64 - name: customer_id data_type: varchar checks: - missing: - invalid: name: "customer_id must be non-empty and sane length" valid_min_length: 1 valid_max_length: 64 - name: transaction_timestamp data_type: timestamp checks: - missing: - name: amount data_type: decimal checks: - missing: - invalid: name: "Amount must not be zero (allow tiny tolerance in case of rare edge cases)" invalid_values: [0] threshold: metric: percent must_be_less_than: 0.1 - name: currency data_type: varchar checks: - missing: - invalid: name: "Currency must be ISO-4217-like (3 uppercase letters)" valid_format: name: ISO-4217 code regex: "^[A-Z]{3}$" - name: transaction_type data_type: varchar checks: - missing: - invalid: name: "Allowed transaction types" valid_values: - DEBIT - CREDIT - TRANSFER - FEE - REVERSAL - ADJUSTMENT - name: status data_type: varchar checks: - missing: - invalid: name: "Allowed statuses" valid_values: - PENDING - POSTED - REVERSED - FAILED - CANCELLED - name: reference_id data_type: varchar checks: - invalid: name: "reference_id length guardrail" valid_max_length: 128
Data contract description
This data contract enforces schema stability, a 24-hour freshness SLA, and the presence of required transaction identifiers, account references, and timestamps. It prevents missing, duplicate, or invalid records, validates controlled formats such as currencies and transaction types, and applies core financial consistency rules on transaction amounts and statuses. Together, these checks help ensure the ledger remains accurate, auditable, and safe to use for balances, regulatory reporting, analytics, and customer-facing applications.
finance_transactions_data_contract.yml
datasetchecks: - schema: allow_extra_columns: false allow_other_column_order: false - row_count: threshold: must_be_greater_than: 0 - freshness: column: transaction_timestamp threshold: unit: hour must_be_less_than_or_equal: 24 - failed_rows: name: "Transaction timestamp must not be in the future" qualifier: ts_not_future expression: transaction_timestamp > ${soda.NOW} - failed_rows: name: "Amount sign must match transaction_type (DEBIT negative, CREDIT positive)" qualifier: amount_sign_by_type expression: > (transaction_type = 'DEBIT' AND amount >= 0) OR (transaction_type = 'CREDIT' AND amount <= 0)
columns: - name: transaction_id data_type: varchar checks: - missing: - duplicate: - invalid: name: "transaction_id must be a UUID" valid_format: name: UUID regex: "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$" - name: account_id data_type: varchar checks: - missing: - invalid: name: "account_id must be non-empty and sane length" valid_min_length: 1 valid_max_length: 64 - name: customer_id data_type: varchar checks: - missing: - invalid: name: "customer_id must be non-empty and sane length" valid_min_length: 1 valid_max_length: 64 - name: transaction_timestamp data_type: timestamp checks: - missing: - name: amount data_type: decimal checks: - missing: - invalid: name: "Amount must not be zero (allow tiny tolerance in case of rare edge cases)" invalid_values: [0] threshold: metric: percent must_be_less_than: 0.1 - name: currency data_type: varchar checks: - missing: - invalid: name: "Currency must be ISO-4217-like (3 uppercase letters)" valid_format: name: ISO-4217 code regex: "^[A-Z]{3}$" - name: transaction_type data_type: varchar checks: - missing: - invalid: name: "Allowed transaction types" valid_values: - DEBIT - CREDIT - TRANSFER - FEE - REVERSAL - ADJUSTMENT - name: status data_type: varchar checks: - missing: - invalid: name: "Allowed statuses" valid_values: - PENDING - POSTED - REVERSED - FAILED - CANCELLED - name: reference_id data_type: varchar checks: - invalid: name: "reference_id length guardrail" valid_max_length: 128
Data contract description
This data contract enforces schema stability, a 24-hour freshness SLA, and the presence of required transaction identifiers, account references, and timestamps. It prevents missing, duplicate, or invalid records, validates controlled formats such as currencies and transaction types, and applies core financial consistency rules on transaction amounts and statuses. Together, these checks help ensure the ledger remains accurate, auditable, and safe to use for balances, regulatory reporting, analytics, and customer-facing applications.
finance_transactions_data_contract.yml
datasetchecks: - schema: allow_extra_columns: false allow_other_column_order: false - row_count: threshold: must_be_greater_than: 0 - freshness: column: transaction_timestamp threshold: unit: hour must_be_less_than_or_equal: 24 - failed_rows: name: "Transaction timestamp must not be in the future" qualifier: ts_not_future expression: transaction_timestamp > ${soda.NOW} - failed_rows: name: "Amount sign must match transaction_type (DEBIT negative, CREDIT positive)" qualifier: amount_sign_by_type expression: > (transaction_type = 'DEBIT' AND amount >= 0) OR (transaction_type = 'CREDIT' AND amount <= 0)
columns: - name: transaction_id data_type: varchar checks: - missing: - duplicate: - invalid: name: "transaction_id must be a UUID" valid_format: name: UUID regex: "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$" - name: account_id data_type: varchar checks: - missing: - invalid: name: "account_id must be non-empty and sane length" valid_min_length: 1 valid_max_length: 64 - name: customer_id data_type: varchar checks: - missing: - invalid: name: "customer_id must be non-empty and sane length" valid_min_length: 1 valid_max_length: 64 - name: transaction_timestamp data_type: timestamp checks: - missing: - name: amount data_type: decimal checks: - missing: - invalid: name: "Amount must not be zero (allow tiny tolerance in case of rare edge cases)" invalid_values: [0] threshold: metric: percent must_be_less_than: 0.1 - name: currency data_type: varchar checks: - missing: - invalid: name: "Currency must be ISO-4217-like (3 uppercase letters)" valid_format: name: ISO-4217 code regex: "^[A-Z]{3}$" - name: transaction_type data_type: varchar checks: - missing: - invalid: name: "Allowed transaction types" valid_values: - DEBIT - CREDIT - TRANSFER - FEE - REVERSAL - ADJUSTMENT - name: status data_type: varchar checks: - missing: - invalid: name: "Allowed statuses" valid_values: - PENDING - POSTED - REVERSED - FAILED - CANCELLED - name: reference_id data_type: varchar checks: - invalid: name: "reference_id length guardrail" valid_max_length: 128
How to Enforce Data Contracts with Soda
Embed data quality through data contracts at any point in your pipeline.
Embed data quality through data contracts at any point in your pipeline.
# pip install soda-{data source} for other data sources
pip install soda-postgress
# verify the contract locally against a data source
soda contract verify -c contract.yml -ds ds_config.yml
# publish and schedule the contract with Soda Cloud
soda contract publish -c contract.yml -sc sc_config.yml
Check out the CLI documentation to learn more.
Check out the CLI documentation to learn more.
How to Automatically Create Data Contracts.
In one Click.
Automatically write and publish data contracts using Soda's AI-powered data contract copilot.

Make data contracts work in production
Business knows what good data looks like. Engineering knows how to deliver it at scale. Soda unites both, turning governance expectations into executable contracts.
Make data contracts work in production
Business knows what good data looks like. Engineering knows how to deliver it at scale. Soda unites both, turning governance expectations into executable contracts.
Make data contracts work in production
Business knows what good data looks like. Engineering knows how to deliver it at scale. Soda unites both, turning governance expectations into executable contracts.
Explore more data contract templates
One new data contract template every day, across industries and use cases
4.4 of 5
Start trusting your data. Today.
Find, understand, and fix any data quality issue in seconds.
From table to record-level.
Trusted by




4.4 of 5
Start trusting your data. Today.
Find, understand, and fix any data quality issue in seconds.
From table to record-level.
Trusted by
Solutions




4.4 of 5
Start trusting your data. Today.
Find, understand, and fix any data quality issue in seconds.
From table to record-level.
Trusted by
Solutions
Company







