### Install and Deploy Documentation with Mike Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/building-doc.md Installs the Mike tool, navigates to the repository, deploys a new version, and sets it as the latest. ```bash pip install mike cd open-data-contract-standard #ensure you are inside the repo mike deploy --push --update-aliases v2.2.1 latest #set latest version to v2.2.1 mike set-default --push latest #by default, users will go to latest ``` -------------------------------- ### Full ODCS Example Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/README.md A comprehensive example demonstrating the complete structure of an Open Data Contract Standard (ODCS) file. This example is linked externally for detailed review. ```YAML See full example here. (examples/all/full-example.odcs.yaml) ``` -------------------------------- ### Complete Schema Example with Various Relationship Notations Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/references.md This comprehensive example demonstrates defining schemas and relationships using both fully qualified and shorthand notations, including custom properties and external contract references. ```yaml schema: - id: users_tbl name: users properties: - id: user_id name: id logicalType: integer relationships: # Fully qualified notation - to: schema/accounts_tbl/properties/acct_user_id description: "Fully qualified reference using id fields" # Shorthand notation - to: accounts.user_id description: "Shorthand reference using name fields" # With custom properties - to: schema/departments_tbl/properties/dept_manager_id customProperties: - property: cardinality value: "one-to-many" - property: label value: "manages" # To external contract (fully qualified) - to: https://example.com/data-contract-v1.yaml#/schema/profiles_tbl/properties/profile_user_id customProperties: - property: description value: "Externally referenced contract (fully qualified)" # To external contract (shorthand) - to: https://example.com/data-contract-v1.yaml#profiles.user_id customProperties: - property: description value: "Externally referenced contract (shorthand)" - id: user_account_number name: account_number logicalType: string # Schema-level composite key relationship relationships: # Fully qualified notation - type: foreignKey from: - schema/users_tbl/properties/user_id_pk - schema/users_tbl/properties/user_account_number to: - schema/accounts_tbl/properties/acct_user_id - schema/accounts_tbl/properties/acct_number # OR shorthand notation - type: foreignKey from: - users.id - users.account_number to: - accounts.user_id - accounts.account_number - id: accounts_tbl name: accounts properties: - id: acct_user_id name: user_id logicalType: integer - id: acct_number name: account_number logicalType: string - id: acct_address name: address logicalType: object properties: - id: addr_street name: street logicalType: string - id: addr_postal_code name: postal_code logicalType: string ``` -------------------------------- ### YAML Pricing Example Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/pricing.md This YAML snippet demonstrates how to define pricing for a data product, specifying the amount, currency, and unit. ```YAML price: priceAmount: 9.95 priceCurrency: USD priceUnit: megabyte ``` -------------------------------- ### SchemaStore ODCS Entry Example Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/schema/README.md Example of how the Open Data Contract Standard (ODCS) is represented in the SchemaStore configuration. This shows the structure for versioning and linking to schema files. ```json { "name": "Open Data Contract Standard (ODCS)", ... "versions": { "": "https://github.com/bitol-io/open-data-contract-standard/blob/main/schema/odcs-json-schema-.json", ... "v2.2.2": "https://github.com/bitol-io/open-data-contract-standard/blob/main/schema/odcs-json-schema-v2.2.2.json" } }, ``` -------------------------------- ### DataContract Example Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/fundamentals.md A basic example of a DataContract resource in YAML format. This defines the API version, kind, and core metadata for a data contract. ```YAML apiVersion: v3.1.0 # Standard version kind: DataContract id: 53581432-6c55-4ba2-a65f-72344a91553a name: seller_payments_v1 version: 1.1.0 # Data Contract Version status: active domain: seller dataProduct: payments tenant: ClimateQuantumInc description: purpose: Views built on top of the seller tables. limitations: Cannot be used in conjunction with days with full moons. usage: Twice a day, preferable before meals. tags: ['finance'] ``` -------------------------------- ### Invalid Configuration - 'from' at Property Level Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/references.md An example of an invalid configuration where the 'from' field is incorrectly specified at the property level. ```yaml # INVALID: 'from' specified at property level schema: - name: users properties: - name: user_id relationships: - from: users.user_id # ERROR: 'from' not allowed at property level to: accounts.id ``` -------------------------------- ### Full Support Channels Configuration Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/support-communication-channels.md Use this comprehensive configuration for detailed support channel setup, including specific tools like Teams, scopes (interactive, announcements), and invitation URLs. It allows for unique IDs and descriptions for each channel. ```yaml support: - id: interactive_teams channel: channel-name-or-identifier tool: teams scope: interactive url: https://bitol.io/teams/channel/my-data-contract-interactive - id: announcements_teams channel: channel-name-or-identifier tool: teams scope: announcements url: https://bitol.io/teams/channel/my-data-contract-announcements invitationUrl: https://bitol.io/teams/channel/my-data-contract-announcements-invit - id: all_announcements channel: channel-name-or-identifier-for-all-announcement description: All announcement for all data contracts tool: teams scope: announcements url: https://bitol.io/teams/channel/all-announcements - id: email_announcements channel: channel-name-or-identifier tool: email scope: announcements url: mailto:datacontract-ann@bitol.io - id: ticket_support channel: channel-name-or-identifier tool: ticket url: https://bitol.io/ticket/my-product ``` -------------------------------- ### Example Data Contract Creation Timestamp Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/custom-other-properties.md This snippet shows the basic YAML structure for including the contract creation timestamp. Use ISO 8601 format for UTC timestamps. ```yaml contractCreatedTs: 2024-09-17T11:58:08Z ``` -------------------------------- ### External Contract Reference Formats Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/references.md Examples of how to reference external data contract files. Supports same folder, full path, URL, and relative path formats. ```yaml # Same folder as current contract data-contract-v1.yaml # Full path file:///path/to/data-contract-v1.yaml # URL https://example.com/data-contract-v1.yaml # Relative path ../../path/to/data-contract-v1.yaml ``` -------------------------------- ### Same Contract Property Reference Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/references.md Example of referencing a specific property within a schema object in the same data contract. ```yaml 'schema/customers_tbl/properties/cust_id_pk' ``` -------------------------------- ### Team Structure Example Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/team.md This YAML snippet demonstrates the structure for defining a team and its members, including roles and historical dates. It follows the RFC 0016 standard. ```YAML team: id: tsc_team name: TSC description: The greatest team ever. members: - username: ceastwood role: Data Scientist dateIn: 2022-08-02 dateOut: 2022-10-01 replacedByUsername: mhopper - id: mhopper_member username: mhopper role: Data Scientist dateIn: 2022-10-01 - id: daustin username: daustin role: Owner description: Keeper of the grail name: David Austin dateIn: 2022-10-01 ``` -------------------------------- ### Custom Properties Example Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/custom-other-properties.md Use customProperties to add non-standard key/value pairs to a data contract. This block is available in many sections. ```YAML customProperties: - id: rfc_ruleset_name property: refRulesetName value: gcsc.ruleset.name - id: some_property_name property: somePropertyName value: property.value - id: data_proc_cluster_name property: dataprocClusterName # Used for specific applications value: [ cluster name ] description: Cluster name for specific applications ``` -------------------------------- ### Invalid Configuration - Mismatched Array Types Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/references.md An example of an invalid configuration with mismatched array types for 'from' and 'to' fields in a relationship. ```yaml # INVALID: Mismatched array types schema: - name: orders relationships: - from: orders.id # ERROR: 'from' is string but 'to' is array to: - items.order_id - items.line_num ``` -------------------------------- ### Same Contract Schema Object Reference Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/references.md Example of referencing a schema object within the same data contract using its ID. ```yaml 'schema/customers_tbl' ``` -------------------------------- ### Deprecated Team Structure Example Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/team.md This YAML snippet shows the deprecated structure for defining team members, including roles, dates, and replacement information. ```YAML team: - username: ceastwood role: Data Scientist dateIn: 2022-08-02 dateOut: 2022-10-01 replacedByUsername: mhopper - username: mhopper role: Data Scientist dateIn: 2022-10-01 - id: daustin_member username: daustin role: Owner description: Keeper of the grail name: David Austin dateIn: 2022-10-01 ``` -------------------------------- ### ODCS Citation Example (BibTeX) Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/README.md This BibTeX entry can be used for citing the Open Data Contract Standard in academic or technical publications. ```bibtex @manual{ODCS2025, title = {Open Data Contract Standard (ODCS)}, author = {{Bitol}}, organization = {LF AI & Data Foundation}, year = {2025}, url = {https://bitol-io.github.io/open-data-contract-standard} } ``` -------------------------------- ### Same Contract Nested Property Reference Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/references.md Example of referencing a nested property within a schema object in the same data contract. ```yaml 'schema/accounts_tbl/properties/address_field/properties/street_field' ``` -------------------------------- ### External Contract Element Reference Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/references.md Example of referencing a specific property within a schema object in an external data contract file. ```yaml 'customer-contract.yaml#/schema/customers_tbl/properties/cust_id_pk' ``` -------------------------------- ### SQL Query with mustBeBetween Operator Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/data-quality.md Example of a SQL query used for data quality checks, specifying a range using the 'mustBeBetween' operator. ```yaml quality: - type: sql query: | SELECT COUNT(*) FROM {table} WHERE {column} IS NOT NULL mustBeBetween: [0, 100] ``` -------------------------------- ### External Contract Nested Property Reference Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/references.md Example of referencing a nested property within a schema object in an external data contract file. ```yaml 'external-contract.yaml#/schema/accounts_tbl/properties/address_field/properties/street_field' ``` -------------------------------- ### Authoritative Definitions Example Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/custom-other-properties.md Authoritative definitions allow delegating contract definitions to third-party systems like enterprise catalogs. This block is available in many sections. ```YAML authoritativeDefinitions: - url: https://catalog.data.gov/dataset/air-quality type: businessDefinition description: Business definition for the dataset. - url: https://www.youtube.com/watch?v=Iq6SxdsIHHE type: videoTutorial description: Discover what a data contract is. - url: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/examples/all/full-example.odcs.yaml type: canonicalUrl description: Data contract's latest version. ``` -------------------------------- ### Invalid Schema: Missing 'from' Field Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/references.md This example shows an invalid schema where the 'from' field is missing at the schema level for a relationship definition. This is a required field for schema-level relationships. ```yaml schema: - name: orders relationships: - to: customers.id # ERROR: 'from' is required at schema level ``` -------------------------------- ### Minimal Support Channels Configuration Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/support-communication-channels.md Use this minimal configuration for basic support channels like Slack or email distribution lists. It requires only the channel identifier. ```yaml support: - channel: "#my-channel" # Simple Slack communication channel - channel: channel-name-or-identifier # Simple distribution list url: mailto:datacontract-ann@bitol.io ``` -------------------------------- ### Multiple Relationships - Shorthand Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/references.md Illustrates a property with multiple foreign key relationships defined using shorthand notation. ```yaml schema: - id: orders_tbl name: orders properties: - id: order_customer_id name: customer_id relationships: # OR shorthand notation - to: customers.id - to: loyalty_members.customer_id ``` -------------------------------- ### Multiple Relationships - Fully Qualified Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/references.md Illustrates a property with multiple foreign key relationships defined using fully qualified notation. ```yaml schema: - id: orders_tbl name: orders properties: - id: order_customer_id name: customer_id relationships: # Fully qualified notation - to: schema/customers_tbl/properties/cust_id_pk - to: schema/loyalty_tbl/properties/member_customer_id ``` -------------------------------- ### Composite Keys - Shorthand Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/references.md Defines composite foreign keys using shorthand notation. Both 'from' and 'to' must be arrays of matching lengths. ```yaml schema: - id: order_items_tbl name: order_items relationships: # OR shorthand notation (concise) - type: foreignKey from: - order_items.order_id - order_items.product_id to: - product_inventory.order_id - product_inventory.product_id ``` -------------------------------- ### Run Schema Diff Analysis Script Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/src/script/README.md Compares JSON schema files to highlight changes between versions. It can auto-detect files or compare specific provided paths. ```bash bash src/script/schema-diff.sh ``` ```bash bash src/script/schema-diff.sh schema/odcs-json-schema-v3.1.0.json schema/odcs-json-schema-v3.0.2.json ``` -------------------------------- ### Simple Foreign Key (Property Level) - Shorthand Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/references.md Defines a foreign key relationship at the property level using shorthand notation. The 'from' field is implicit and should not be specified. ```yaml schema: - id: users_tbl name: users properties: - id: user_id_field name: user_id relationships: # OR shorthand notation (uses name, concise) - to: accounts.owner_id # Note: DO NOT include 'from' field at property level ``` -------------------------------- ### Schema-Level Relationships - Shorthand Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/references.md Defines schema-level foreign key relationships using shorthand notation. Both 'from' and 'to' fields are required. ```yaml schema: - id: users_tbl name: users relationships: # OR shorthand notation (concise) - from: users.account_id to: accounts.id type: foreignKey ``` -------------------------------- ### General Server Structure in YAML Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/infrastructure-servers.md Defines the basic structure for a server entry within a data contract, including essential fields like ID, name, type, description, environment, roles, and custom properties. Specific server types may require additional fields. ```yaml servers: - id: my_awesome_server server: my-server-name type: description: environment: # according to the server type, see below roles: - customProperties: - ``` -------------------------------- ### Custom Soda Duplicate Percentage Check Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/data-quality.md Integrates with Soda to check for duplicate percentages, passing specific column names and a threshold to the Soda tool. ```yaml quality: - id: soda_duplicate_percent type: custom engine: soda implementation: | type: duplicate_percent # Block columns: # passed as-is - carrier # to the tool - shipment_numer # (Soda in this situation) must_be_less_than: 1.0 # ``` -------------------------------- ### SQL Query with mustBeGreaterThan and mustBeLessThan Operators Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/data-quality.md Equivalent SQL query demonstrating the use of 'mustBeGreaterThan' and 'mustBeLessThan' operators to define the same range as 'mustBeBetween'. ```yaml quality: - type: sql query: | SELECT COUNT(*) FROM {table} WHERE {column} IS NOT NULL mustBeGreaterThan: 0 mustBeLessThan: 100 ``` -------------------------------- ### Composite Keys - Fully Qualified Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/references.md Defines composite foreign keys using fully qualified notation. Both 'from' and 'to' must be arrays of matching lengths. ```yaml schema: - id: order_items_tbl name: order_items relationships: # Fully qualified notation (stable) - type: foreignKey from: - schema/order_items_tbl/properties/item_order_id - schema/order_items_tbl/properties/item_product_id to: - schema/product_inventory_tbl/properties/inv_order_id - schema/product_inventory_tbl/properties/inv_product_id ``` -------------------------------- ### SQL Check with Cron Scheduling Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/data-quality.md A SQL check for non-null counts, scheduled to run daily at 8 PM using cron syntax. ```yaml quality: - id: count_less_than_3600 type: sql query: | SELECT COUNT(*) FROM {object} WHERE {property} IS NOT NULL mustBeLessThan: 3600 scheduler: cron schedule: 0 20 * * * ``` -------------------------------- ### Schema-Level Relationships - Fully Qualified Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/references.md Defines schema-level foreign key relationships using fully qualified notation. Both 'from' and 'to' fields are required. ```yaml schema: - id: users_tbl name: users relationships: # Fully qualified notation (stable) - from: schema/users_tbl/properties/user_account_id to: schema/accounts_tbl/properties/acct_id_pk type: foreignKey ``` -------------------------------- ### Delete an Incorrect Documentation Version Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/building-doc.md Resets the 'latest' version tag to a previous version and then deletes the incorrect tag. ```bash mike deploy --push --update-aliases latest mike delete --push ``` -------------------------------- ### Simple Foreign Key (Property Level) - Fully Qualified Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/references.md Defines a foreign key relationship at the property level using fully qualified notation. The 'from' field is implicit and should not be specified. ```yaml schema: - id: users_tbl name: users properties: - id: user_id_field name: user_id relationships: # Fully qualified notation (uses id, stable) - to: schema/accounts_tbl/properties/owner_id_field ``` -------------------------------- ### Simple Array Schema Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/schema.md Defines a schema with a simple array of strings. Use this for properties that contain a list of text values. ```YAML schema: - name: AnObject logicalType: object properties: - name: street_lines logicalType: array items: logicalType: string ``` -------------------------------- ### Null Values Check (Percentage) Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/data-quality.md Checks if the percentage of null values in a column is less than a specified threshold (1% in this case). It uses the `nullValues` metric with `unit: percent`. ```yaml properties: - name: order_status quality: - id: order_status_null_percent metric: nullValues mustBeLessThan: 1 unit: percent description: "There must be less than 1% null values in the column." ``` -------------------------------- ### Row Count Check (Schema-Level) Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/data-quality.md Verifies that the 'orders' table has a row count between 100 and 120 (inclusive). ```yaml schema: - name: orders quality: - id: orders_row_count metric: rowCount mustBeBetween: [100, 120] ``` -------------------------------- ### Nested Properties - Shorthand Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/references.md References nested properties within a schema using shorthand notation. ```yaml schema: - id: users_tbl name: users properties: - id: user_id_pk name: id relationships: # OR shorthand notation - to: accounts.address.postal_code ``` -------------------------------- ### Dataset Access Roles Configuration Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/roles.md Defines roles for accessing datasets, specifying access levels and approvers. Use this to configure granular permissions for different user groups. ```YAML roles: - role: microstrategy_user_opr access: read firstLevelApprovers: Reporting Manager secondLevelApprovers: 'mandolorian' - id: bq_queryman_user_opr role: bq_queryman_user_opr access: read firstLevelApprovers: Reporting Manager secondLevelApprovers: na - id: risk_data_access_opr role: risk_data_access_opr access: read firstLevelApprovers: Reporting Manager secondLevelApprovers: 'dathvador' - id: bq_unica_user_opr role: bq_unica_user_opr access: write firstLevelApprovers: Reporting Manager secondLevelApprovers: 'mickey' ``` -------------------------------- ### Nested Properties - Fully Qualified Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/references.md References nested properties within a schema using fully qualified notation. ```yaml schema: - id: users_tbl name: users properties: - id: user_id_pk name: id relationships: # Fully qualified notation - to: schema/accounts_tbl/properties/address_field/properties/postal_code_field ``` -------------------------------- ### Array of Objects Schema Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/schema.md Defines a schema with an array where each item is an object. Use this for complex list structures where each element has multiple properties. ```YAML schema: - id: another_obj name: AnotherObject logicalType: object properties: - id: x_prop name: x logicalType: array items: logicalType: object properties: - id: id_field name: id logicalType: string physicalType: VARCHAR(40) - id: zip_field name: zip logicalType: string physicalType: VARCHAR(15) ``` -------------------------------- ### Library Data Quality Rule (Implicit Type) Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/data-quality.md A simplified way to define a library metric for null values, where the `type: library` is omitted as the `metric` property is present. ```yaml properties: - name: order_id quality: - id: order_id_no_nulls_simplified metric: nullValues mustBe: 0 description: "There must be no null values in the column." ``` -------------------------------- ### Complete Schema Definition Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/schema.md Defines a complete data contract schema including object details, properties with their types, partitioning, and transformation logic. Use this for comprehensive data contract definitions. ```YAML schema: - id: tbl_obj name: tbl logicalType: object physicalType: table physicalName: tbl_1 description: Provides core payment metrics authoritativeDefinitions: - url: https://catalog.data.gov/dataset/air-quality type: businessDefinition description: Business definition for the dataset. - url: https://youtu.be/jbY1BKFj9ec type: videoTutorial tags: ['finance'] dataGranularityDescription: Aggregation on columns txn_ref_dt, pmt_txn_id properties: - id: txn_ref_dt_prop name: txn_ref_dt businessName: transaction reference date logicalType: date physicalType: date description: null partitioned: true partitionKeyPosition: 1 criticalDataElement: false tags: [] classification: public transformSourceObjects: - table_name_1 - table_name_2 - table_name_3 transformLogic: sel t1.txn_dt as txn_ref_dt from table_name_1 as t1, table_name_2 as t2, table_name_3 as t3 where t1.txn_dt=date-3 transformDescription: Defines the logic in business terms. examples: - 2022-10-03 - 2020-01-28 - id: rcvr_id_prop name: rcvr_id primaryKey: true primaryKeyPosition: 1 businessName: receiver id logicalType: string physicalType: varchar(18) required: false description: A description for column rcvr_id. partitioned: false partitionKeyPosition: -1 criticalDataElement: false tags: [] classification: restricted encryptedName: enc_rcvr_id - id: rcvr_cntry_code_prop name: rcvr_cntry_code primaryKey: false primaryKeyPosition: -1 businessName: receiver country code logicalType: string physicalType: varchar(2) required: false description: null partitioned: false partitionKeyPosition: -1 criticalDataElement: false tags: [] classification: public authoritativeDefinitions: - url: https://zeenea.app/asset/742b358f-71a5-4ab1-bda4-dcdba9418c25 type: businessDefinition - url: https://github.com/myorg/myrepo type: transformationImplementation - url: jdbc:postgresql://localhost:5432/adventureworks/tbl_1/rcvr_cntry_code type: implementation encryptedName: rcvr_cntry_code_encrypted ``` -------------------------------- ### Duplicate Rows Check (Schema-Level) Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/data-quality.md Ensures that the combination of 'tenant_id' and 'order_id' in the 'orders' table is unique (0 duplicates). ```yaml schema: - name: orders quality: - id: orders_unique_tenant_order description: The combination of tenant_id and order_id must be unique metric: duplicateValues mustBe: 0 arguments: properties: # Properties refer to the property in the schema. - tenant_id - order_id ``` -------------------------------- ### Null Values Check (Exact Count) Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/data-quality.md Ensures that a specific column has exactly zero null values. This check uses the `nullValues` metric and requires the count to be 0. ```yaml properties: - name: customer_id quality: - id: customer_id_no_nulls metric: nullValues mustBe: 0 description: "There must be no null values in the column." ``` -------------------------------- ### SQL Query for Non-Null Count Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/data-quality.md Executes a SQL query to count non-null values for a given property in an object, expecting the count to be less than 3600. ```yaml quality: - id: sql_count_not_null type: sql query: | SELECT COUNT(*) FROM {object} WHERE {property} IS NOT NULL mustBeLessThan: 3600 ``` -------------------------------- ### Duplicate Values Check (Count) Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/data-quality.md Checks for duplicate values in the 'email_address' column, ensuring there are less than 10 duplicate rows. ```yaml properties: - name: email_address quality: - id: email_duplicate_values metric: duplicateValues mustBeLessThan: 10 unit: rows description: "There must be less than 10 duplicate values in the column." ``` -------------------------------- ### Library Data Quality Rule (Explicit Type) Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/data-quality.md Specifies a predefined library metric to check for null values in a column. The `type: library` is explicit. ```yaml properties: - name: order_id quality: - id: order_id_no_nulls type: library metric: nullValues mustBe: 0 unit: rows description: "There must be no null values in the column." ``` -------------------------------- ### SLA Properties Definition Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/service-level-agreement.md Defines various service-level agreement properties for a data contract, such as latency, general availability, end of support, end of life, retention, frequency, and time of availability. Use this to specify quality and operational metrics for data. ```YAML slaProperties: - id: latency_4_days property: latency # Property, see list of values in Data QoS (see below) value: 4 unit: d # d, day, days for days; y, yr, years for years element: tab1.txn_ref_dt scheduler: cron schedule: 0 30 * * * - id: main_ga property: generalAvailability value: 2022-05-12T09:30:10-08:00 description: GA at 12.5.22 - id: eos property: endOfSupport value: 2032-05-12T09:30:10-08:00 - id: eol property: endOfLife value: 2042-05-12T09:30:10-08:00 - id: retention property: retention value: 3 unit: y element: tab1.txn_ref_dt - id: frequency property: frequency value: 1 valueExt: 1 unit: d element: tab1.txn_ref_dt - id: reg_toa property: timeOfAvailability value: 09:00-08:00 element: tab1.txn_ref_dt driver: regulatory # Describes the importance of the SLA: [regulatory|analytics|operational|...] - id: analytics_toa property: timeOfAvailability value: 08:00-08:00 element: tab1.txn_ref_dt driver: analytics ``` -------------------------------- ### Duplicate Values Check (Percentage) Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/data-quality.md Validates that the percentage of duplicate values in the 'phone_number' column is less than 1%. ```yaml properties: - name: phone_number quality: - id: phone_duplicate_percent metric: duplicateValues mustBeLessThan: 1 unit: percent ``` -------------------------------- ### Missing Values Check Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/data-quality.md Checks if the number of rows with missing values (null, '', 'N/A', 'n/a') is less than 100 for the 'email_address' property. ```yaml properties: - name: email_address quality: - id: email_missing_values metric: missingValues arguments: missingValues: [null, '', 'N/A', 'n/a'] mustBeLessThan: 100 unit: rows # rows (default) or percent ``` -------------------------------- ### Invalid Values Check (Pattern) Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/data-quality.md Validates that the 'iban' property matches the specified IBAN pattern and has 0 invalid values. ```yaml properties: - name: iban quality: - id: iban_pattern_check metric: invalidValues mustBe: 0 description: "The value must be an IBAN." arguments: pattern: '^[A-Z]{2}[0-9]{2}[A-Z0-9]{4}[0-9]{7}([A-Z0-9]?){0,16}$' ``` -------------------------------- ### Invalid Values Check (List) Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/data-quality.md Ensures that the 'line_item_unit' property has fewer than 5 rows with values not in the allowed set ['pounds', 'kg']. ```yaml properties: - name: line_item_unit quality: - id: line_item_unit_valid_values metric: invalidValues arguments: validValues: ['pounds', 'kg'] mustBeLessThan: 5 unit: rows ``` -------------------------------- ### Text Data Quality Rule Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/data-quality.md Defines a human-readable text description for a data quality attribute. This can later be translated into an executable check. ```yaml quality: - id: email_verified_text type: text description: "The email address was verified by the system." ``` -------------------------------- ### Custom Great Expectations Row Count Check Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/data-quality.md Uses Great Expectations to verify that the table row count falls between 10000 and 50000. ```yaml quality: - id: row_count_btwn_10_50 type: custom engine: greatExpectations implementation: | type: expect_table_row_count_to_be_between # Block kwargs: minValue: 10000 # to the tool maxValue: 50000 # (Great Expectations in this situation) ``` -------------------------------- ### Physical Type Timestamp (UTC) Representation Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/schema.md Defines a field for timestamp values in UTC using the `timestamp` logical type and explicitly setting the `physicalType` to DATETIME. ```yaml - name: event_date logicalType: timestamp physicalType: DATETIME logicalTypeOptions: format: "yyyy-MM-ddTHH:mm:ssZ" examples: - "2024-03-10T14:22:35Z" ``` -------------------------------- ### Time Only Representation Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/schema.md Defines a field for time-only values using the `time` logical type and the 'HH:mm:ss' format. ```yaml - name: event_start_time logicalType: time logicalTypeOptions: format: "HH:mm:ss" examples: - "08:30:00" ``` -------------------------------- ### Timestamp (UTC) Representation Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/schema.md Defines a field for timestamp values in UTC, using the `timestamp` logical type and the 'yyyy-MM-ddTHH:mm:ssZ' format. ```yaml - name: created_at logicalType: timestamp logicalTypeOptions: format: "yyyy-MM-ddTHH:mm:ssZ" examples: - "2024-03-10T14:22:35Z" ``` -------------------------------- ### Invalid Schema: Different Array Lengths Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/references.md This snippet illustrates an invalid schema configuration where the 'from' and 'to' arrays in a relationship have different lengths. Runtime validation will detect this error. ```yaml schema: - name: orders relationships: - from: - orders.id - orders.customer_id to: - items.order_id - items.customer_id - items.line_num ``` -------------------------------- ### Date Only Representation Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/schema.md Defines a field for date-only values using the `date` logical type and specifies the 'yyyy-MM-dd' format. ```yaml - name: event_date logicalType: date logicalTypeOptions: format: "yyyy-MM-dd" examples: - "2024-07-10" ``` -------------------------------- ### ODCS Mime/Media Type Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/README.md The official media type for ODCS data, specifying the format and version. ```text application/odcs+yaml;version=3.1.0 ``` -------------------------------- ### Timestamp with Timezone Representation Source: https://github.com/bitol-io/open-data-contract-standard/blob/main/docs/schema.md Defines a field for timestamp values with a specific timezone ('Australia/Sydney'), using the `timestamp` logical type and indicating timezone presence. ```yaml - name: created_at_sydney logicalType: timestamp logicalTypeOptions: format: "yyyy-MM-ddTHH:mm:ssZ" timezone: true defaultTimezone: "Australia/Sydney" examples: - "2024-03-10T14:22:35+10:00" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.