Skip to content

Support sample table data in DBML#800

Merged
hdnax merged 234 commits intomasterfrom
feat/sample-table-data
Feb 13, 2026
Merged

Support sample table data in DBML#800
hdnax merged 234 commits intomasterfrom
feat/sample-table-data

Conversation

@hdnax
Copy link
Contributor

@hdnax hdnax commented Jan 16, 2026

Summary

Add support for sample table data in DBML.

Doc: https://github.com/holistics/dbml/blob/78d79441758adc973376a18531b8d0b3807f9208/dbml-homepage/docs/docs.md
TDD: https://www.notion.so/holistics/TDD-80-Sample-Table-Data-2e6f89dc7e498073ac17c09a842aa64b

Support CommaExpressionNode in parser

  • Added CommaExpressionNode to AST for comma-separated value lists
  • Added lexer support for scientific notation (e.g., 1.23e5, -4.56e-3)

Support sample table data in DBML

Table Users {
  id string [pk]
  name string
  age int

  Records { // implicit columns
    "id1", "Alice", 18
    "id2", "Bob", 19
  }

  Records (id, name) { // explicit columns
    "id3", "Charlie"
  }
}

Records Users(id, name) { // always explicit
  "id4", "David"
}
  • Implicit/explicit column lists
  • Full type validation and constraint checking (PK, FK, unique, not null)
  • Support for strings, numbers, booleans, dates, enums, null, and SQL expressions
  • Validation warnings instead of errors for constraint violations

Handle INSERT statements in importers and exporters

Exporters: Convert Records to INSERT statements for all SQL dialects (MySQL, PostgreSQL, Oracle, MSSQL, Snowflake) with automatic FK constraint handling

Importers: Parse INSERT statements from SQL and convert to DBML Records, including Snowflake support

Add diagnostics provider for reusable logic related to errors and warnings

  • New DBMLDiagnosticsProvider class with provideDiagnostics(), provideErrors(), provideWarnings() methods

Others

  • Hardcode Report<T, E> to Report

    • E is now always CompileError, also CompileWarning is supported
    • Simplified API with getErrors() and getWarnings() methods
  • Expose reusable SQL type checking and value extraction functions

    • Type checkers: isSqlNumericType(), isSqlStringType(), isSqlDateTimeType(), isSqlBooleanType()
    • Value extractors: tryExtractBoolean(), tryExtractInteger(), tryExtractFloat(), tryExtractString(), tryExtractDate(), tryExtractDateTime(), tryExtractTime()
    • Utilities: normalizeRecordValue(), addDoubleQuoteIfNeeded()

Issue

(issue link here)

@hdnax hdnax force-pushed the feat/sample-table-data branch 6 times, most recently from e75ad9b to 7a79669 Compare January 16, 2026 07:52
@hdnax hdnax force-pushed the parser/refactor-binder branch from 447eb87 to 509240a Compare January 16, 2026 09:03
@hdnax hdnax force-pushed the feat/sample-table-data branch 7 times, most recently from 4fb94da to 20f2cb1 Compare January 19, 2026 03:07
@hdnax hdnax requested a review from xuantho573 January 19, 2026 06:26
@hdnax hdnax force-pushed the feat/sample-table-data branch 7 times, most recently from b245e94 to 9fa707d Compare January 22, 2026 13:12
Base automatically changed from parser/refactor-binder to master January 25, 2026 07:56
@hdnax hdnax force-pushed the feat/sample-table-data branch 7 times, most recently from 6b9699e to 9aa84ab Compare January 26, 2026 04:30
@hdnax hdnax force-pushed the feat/sample-table-data branch from 1c6516b to f16c2d2 Compare February 12, 2026 04:14
@hdnax hdnax force-pushed the feat/sample-table-data branch from f9618f4 to 2ead9c2 Compare February 12, 2026 09:45
@github-actions
Copy link

Coverage Report

Commit: 27b1314

Overall Coverage

Metric Coverage
Lines ✅ 84.15% (5401/6418)
Statements ✅ 83.50% (5764/6903)
Functions ✅ 89.50% (1261/1409)
Branches ⚠️ 75.46% (2986/3957)

Package Coverage

Package Lines Statements Functions Branches
@dbml/dbml-cli ✅ 100.00% ✅ 100.00% ✅ 100.00% ✅ 100.00%
@dbml/dbml-connector ⚠️ 64.58% ⚠️ 64.39% ⚠️ 59.53% ⚠️ 59.13%
@dbml/dbml-core N/A N/A N/A N/A
@dbml/dbml-parse ✅ 87.52% ✅ 86.77% ✅ 93.68% ⚠️ 77.99%

⚠️ Coverage Warnings

The following packages have coverage below 80%:

  • @dbml/dbml-connector: 64.58% line coverage

Files with Coverage Below 80%

@dbml/dbml-connector

9 file(s) below 80% coverage
File Lines Statements Functions Branches
src/connectors/bigquery/index.ts 0.00% 0.00% 0.00% 0.00%
src/utils/credential-loader.ts 0.00% 0.00% 0.00% 0.00%
src/utils/helpers.ts 0.00% 0.00% 0.00% 0.00%
src/connectors/snowflake/index.ts 10.56% 10.31% 0.00% 0.00%
src/utils/parseSchema.ts 46.15% 42.85% 28.57% 27.27%
src/connectors/connector.ts 66.66% 66.66% 100.00% 57.14%
src/connectors/oracle/tables.ts 71.25% 67.39% 100.00% 56.96%
src/connectors/oracle/index.ts 80.00% 80.76% 100.00% 25.00%
src/connectors/oracle/utils.ts 85.71% 85.71% 100.00% 71.42%

@dbml/dbml-parse

39 file(s) below 80% coverage
File Lines Statements Functions Branches
src/compiler/queries/container/scope.ts 0.00% 0.00% 0.00% 100.00%
src/services/diagnostics/provider.ts 0.00% 0.00% 0.00% 0.00%
src/compiler/queries/parse.ts 50.00% 50.00% 50.00% 100.00%
src/core/interpreter/elementInterpreter/project.ts 51.42% 51.42% 100.00% 36.36%
src/core/interpreter/records/utils/data/sqlTypes.ts 56.25% 58.82% 75.00% 46.55%
src/core/analyzer/symbol/utils.ts 56.52% 56.52% 100.00% 50.00%
src/core/analyzer/binder/elementBinder/note.ts 62.50% 64.70% 83.33% 50.00%
src/compiler/queries/utils.ts 64.83% 65.95% 88.88% 47.43%
src/core/interpreter/records/utils/data/values.ts 65.13% 57.14% 72.72% 50.37%
src/compiler/queries/token.ts 66.66% 66.66% 66.66% 100.00%
src/core/parser/utils.ts 71.05% 71.79% 100.00% 78.98%
src/core/analyzer/validator/elementValidators/indexes.ts 72.00% 74.07% 90.90% 59.61%
src/core/analyzer/binder/elementBinder/enum.ts 72.22% 73.68% 100.00% 62.50%
src/core/analyzer/validator/elementValidators/note.ts 74.50% 72.72% 76.92% 71.87%
src/core/analyzer/analyzer.ts 75.00% 66.66% 60.00% 100.00%
src/core/analyzer/symbol/symbolIndex.ts 76.92% 77.50% 92.85% 50.00%
src/core/analyzer/utils.ts 77.77% 76.36% 88.88% 75.00%
src/core/analyzer/binder/elementBinder/project.ts 77.77% 78.94% 100.00% 50.00%
src/core/analyzer/validator/elementValidators/checks.ts 77.77% 79.31% 93.75% 71.87%
src/core/analyzer/validator/elementValidators/records.ts 78.08% 78.66% 93.75% 74.19%
src/core/analyzer/validator/elementValidators/project.ts 78.12% 78.78% 100.00% 56.25%
src/core/utils.ts 78.57% 77.41% 80.00% 60.71%
src/core/analyzer/binder/elementBinder/ref.ts 78.78% 80.00% 90.90% 75.00%
src/core/analyzer/binder/elementBinder/indexes.ts 79.06% 77.77% 90.90% 68.18%
src/core/analyzer/binder/elementBinder/tableGroup.ts 80.00% 80.64% 100.00% 50.00%
src/core/interpreter/records/utils/constraints/pk.ts 82.00% 80.00% 92.30% 54.54%
src/services/suggestions/utils.ts 82.35% 76.78% 92.85% 70.37%
src/core/analyzer/binder/elementBinder/records.ts 82.79% 83.33% 93.75% 71.42%
src/compiler/queries/container/token.ts 83.33% 85.71% 100.00% 75.00%
src/core/analyzer/validator/elementValidators/tablePartial.ts 83.43% 80.72% 87.23% 64.28%
src/core/analyzer/binder/elementBinder/tablePartial.ts 86.00% 86.53% 100.00% 69.23%
src/core/parser/parser.ts 87.05% 87.20% 100.00% 79.32%
src/services/suggestions/recordRowSnippet.ts 88.67% 84.61% 100.00% 78.00%
src/compiler/queries/symbol.ts 91.30% 92.00% 100.00% 78.57%
__tests__/utils/compiler.ts 92.92% 92.75% 100.00% 70.32%
src/core/interpreter/elementInterpreter/sticky_note.ts 95.00% 95.23% 100.00% 66.66%
src/core/interpreter/records/utils/constraints/unique.ts 96.15% 93.93% 100.00% 66.66%
src/core/analyzer/symbol/symbolTable.ts 100.00% 100.00% 100.00% 75.00%
src/services/definition/provider.ts 100.00% 100.00% 100.00% 75.00%

@hdnax hdnax added PR: Breaking Change 💥 A type of pull request used for changelog categories PR: Bug Fix 🐛 A type of pull request used for changelog categories PR: New Feature 🚀 A type of pull request used for changelog categories labels Feb 13, 2026
@hdnax hdnax merged commit 05c43e2 into master Feb 13, 2026
3 of 4 checks passed
@github-actions
Copy link

Coverage Report

Commit: 8c245a1

Overall Coverage

Metric Coverage
Lines ✅ 84.47% (5421/6418)
Statements ✅ 83.78% (5783/6903)
Functions ✅ 89.50% (1261/1409)
Branches ⚠️ 75.54% (2989/3957)

Package Coverage

Package Lines Statements Functions Branches
@dbml/dbml-cli ✅ 100.00% ✅ 100.00% ✅ 100.00% ✅ 100.00%
@dbml/dbml-connector ⚠️ 64.58% ⚠️ 64.39% ⚠️ 59.53% ⚠️ 59.13%
@dbml/dbml-core N/A N/A N/A N/A
@dbml/dbml-parse ✅ 87.89% ✅ 87.09% ✅ 93.68% ⚠️ 78.07%

⚠️ Coverage Warnings

The following packages have coverage below 80%:

  • @dbml/dbml-connector: 64.58% line coverage

Files with Coverage Below 80%

@dbml/dbml-connector

9 file(s) below 80% coverage
File Lines Statements Functions Branches
src/connectors/bigquery/index.ts 0.00% 0.00% 0.00% 0.00%
src/utils/credential-loader.ts 0.00% 0.00% 0.00% 0.00%
src/utils/helpers.ts 0.00% 0.00% 0.00% 0.00%
src/connectors/snowflake/index.ts 10.56% 10.31% 0.00% 0.00%
src/utils/parseSchema.ts 46.15% 42.85% 28.57% 27.27%
src/connectors/connector.ts 66.66% 66.66% 100.00% 57.14%
src/connectors/oracle/tables.ts 71.25% 67.39% 100.00% 56.96%
src/connectors/oracle/index.ts 80.00% 80.76% 100.00% 25.00%
src/connectors/oracle/utils.ts 85.71% 85.71% 100.00% 71.42%

@dbml/dbml-parse

39 file(s) below 80% coverage
File Lines Statements Functions Branches
src/compiler/queries/container/scope.ts 0.00% 0.00% 0.00% 100.00%
src/services/diagnostics/provider.ts 0.00% 0.00% 0.00% 0.00%
src/compiler/queries/parse.ts 50.00% 50.00% 50.00% 100.00%
src/core/interpreter/elementInterpreter/project.ts 51.42% 51.42% 100.00% 36.36%
src/core/interpreter/records/utils/data/sqlTypes.ts 56.25% 58.82% 75.00% 46.55%
src/core/analyzer/symbol/utils.ts 56.52% 56.52% 100.00% 50.00%
src/core/analyzer/binder/elementBinder/note.ts 62.50% 64.70% 83.33% 50.00%
src/compiler/queries/utils.ts 64.83% 65.95% 88.88% 47.43%
src/core/interpreter/records/utils/data/values.ts 65.13% 57.14% 72.72% 50.37%
src/compiler/queries/token.ts 66.66% 66.66% 66.66% 100.00%
src/core/analyzer/binder/elementBinder/enum.ts 72.22% 73.68% 100.00% 62.50%
src/core/analyzer/validator/elementValidators/note.ts 72.54% 70.90% 76.92% 68.75%
src/core/analyzer/validator/elementValidators/indexes.ts 74.66% 75.30% 90.90% 63.46%
src/core/analyzer/analyzer.ts 75.00% 66.66% 60.00% 100.00%
src/core/analyzer/symbol/symbolIndex.ts 76.92% 77.50% 92.85% 50.00%
src/core/analyzer/utils.ts 77.77% 76.36% 88.88% 75.00%
src/core/analyzer/binder/elementBinder/project.ts 77.77% 78.94% 100.00% 50.00%
src/core/analyzer/validator/elementValidators/checks.ts 77.77% 79.31% 93.75% 71.87%
src/core/analyzer/validator/elementValidators/records.ts 78.08% 78.66% 93.75% 74.19%
src/core/analyzer/validator/elementValidators/project.ts 78.12% 78.78% 100.00% 56.25%
src/core/utils.ts 78.57% 77.41% 80.00% 60.71%
src/core/analyzer/binder/elementBinder/ref.ts 78.78% 80.00% 90.90% 75.00%
src/core/analyzer/binder/elementBinder/indexes.ts 79.06% 77.77% 90.90% 68.18%
src/core/analyzer/binder/elementBinder/tableGroup.ts 80.00% 80.64% 100.00% 50.00%
src/services/suggestions/utils.ts 80.39% 75.00% 92.85% 68.51%
src/core/interpreter/records/utils/constraints/pk.ts 82.00% 80.00% 92.30% 54.54%
src/core/analyzer/binder/elementBinder/records.ts 82.79% 83.33% 93.75% 71.42%
src/compiler/queries/container/token.ts 83.33% 85.71% 100.00% 75.00%
src/core/analyzer/validator/elementValidators/tablePartial.ts 83.43% 80.72% 87.23% 64.28%
src/core/analyzer/binder/elementBinder/tablePartial.ts 86.00% 86.53% 100.00% 69.23%
src/core/parser/parser.ts 86.85% 87.00% 100.00% 78.94%
src/services/suggestions/recordRowSnippet.ts 88.67% 84.61% 100.00% 78.00%
src/services/suggestions/provider.ts 88.79% 84.61% 98.07% 79.90%
src/compiler/queries/symbol.ts 91.30% 92.00% 100.00% 78.57%
__tests__/utils/compiler.ts 92.92% 92.75% 100.00% 70.32%
src/core/interpreter/elementInterpreter/sticky_note.ts 95.00% 95.23% 100.00% 66.66%
src/core/interpreter/records/utils/constraints/unique.ts 96.15% 93.93% 100.00% 66.66%
src/core/analyzer/symbol/symbolTable.ts 100.00% 100.00% 100.00% 75.00%
src/services/definition/provider.ts 100.00% 100.00% 100.00% 75.00%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: Breaking Change 💥 A type of pull request used for changelog categories PR: Bug Fix 🐛 A type of pull request used for changelog categories PR: New Feature 🚀 A type of pull request used for changelog categories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants