Skip to content

Conversation

@edgarrmondragon
Copy link
Collaborator

@edgarrmondragon edgarrmondragon commented Nov 19, 2025

Summary by Sourcery

Enable schemas to carry arbitrary parameters for custom SQL data types by introducing the x-sql-datatype-properties extension and wiring it through the Schema model, serialization logic, tests, and documentation.

New Features:

  • Add support for arbitrary properties for x-sql-datatype via a new x-sql-datatype-properties extension on the Schema class

Enhancements:

  • Include x-sql-datatype-properties in the JSON Schema extension list and in schema-to-dict and dict-to-schema conversions

Documentation:

  • Update SQL target guide with examples demonstrating custom datatype handlers using x-sql-datatype-properties

Tests:

  • Add tests for round-tripping schemas with custom SQL datatypes and their properties

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Nov 19, 2025

Reviewer's Guide

This PR introduces support for the x-sql-datatype-properties extension by extending the Schema model, adding round-trip tests for custom SQL datatype properties, and updating the SQL-target documentation with examples for registering and using handlers that consume these properties.

ER diagram for JSON Schema with x-sql-datatype-properties

erDiagram
    addresses {
        number int
        x-sql-datatype varchar
    }
    values {
        x-sql-datatype varchar
        x-sql-datatype-properties json
    }
    addresses ||--o| values : contains
Loading

Class diagram for updated Schema model with x-sql-datatype-properties

classDiagram
class Schema {
  +str|None x_sql_datatype
  +dict[str, Any]|None x_sql_datatype_properties
  +str|None contentEncoding
  +bool|None deprecated
  +Any|None oneOf
}
Loading

Class diagram for custom SQL datatype handler registration

classDiagram
class JSONSchemaToSQL {
  +register_sql_datatype_handler(datatype: str, handler: Callable)
}
class MyConnector {
  +jsonschema_to_sql()
}
class VectorType {
  +__init__(**kwargs)
}
JSONSchemaToSQL <|-- MyConnector
MyConnector o-- VectorType: uses
Loading

File-Level Changes

Change Details Files
Extend Schema model to support x-sql-datatype-properties
  • Added 'x-sql-datatype-properties' to the list of JSON Schema extensions
  • Introduced x_sql_datatype_properties attribute in the Schema class
singer_sdk/singerlib/schema.py
Add tests for custom SQL datatype properties round-trip
  • Defined SCHEMA_WITH_CUSTOM_SQL_DATATYPE and its dict representation
  • Parameterized test_schema_to_dict to include custom datatype properties
  • Parameterized test_schema_from_dict to include custom datatype properties
tests/singerlib/test_schema.py
Update SQL-target documentation for datatype properties
  • Demonstrated vector_to_sql function using x-sql-datatype-properties
  • Registered custom 'vector' handler in MyConnector.jsonschema_to_sql
  • Augmented YAML plugin example with x-sql-datatype-properties usage
docs/guides/sql-target.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@read-the-docs-community
Copy link

read-the-docs-community bot commented Nov 19, 2025

Documentation build overview

📚 Meltano SDK | 🛠️ Build #30415171 | 📁 Comparing ba73a5e against latest (c0d09dd)


🔍 Preview build

Show files changed (1 files in total): 📝 1 modified | ➕ 0 added | ➖ 0 deleted
File Status
guides/sql-target.html 📝 modified

@codecov
Copy link

codecov bot commented Nov 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.80%. Comparing base (c0d09dd) to head (ba73a5e).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3373   +/-   ##
=======================================
  Coverage   93.80%   93.80%           
=======================================
  Files          69       69           
  Lines        5780     5781    +1     
  Branches      718      718           
=======================================
+ Hits         5422     5423    +1     
  Misses        254      254           
  Partials      104      104           
Flag Coverage Δ
core 81.64% <100.00%> (+<0.01%) ⬆️
end-to-end 76.35% <100.00%> (+<0.01%) ⬆️
optional-components 43.45% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 19, 2025

CodSpeed Performance Report

Merging #3373 will not alter performance

Comparing feat/sql-datatype-props (ba73a5e) with main (c0d09dd)

Summary

✅ 8 untouched

…atype-properties`

Signed-off-by: Edgar Ramírez-Mondragón <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

SQL Support for SQL taps and targets Type/Target Singer targets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants