Skip to content

Commit

Permalink
refactor: Use a single source of truth for built-in capabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Jul 16, 2024
1 parent f68d5c6 commit 5b4a7e6
Show file tree
Hide file tree
Showing 19 changed files with 709 additions and 523 deletions.
17 changes: 17 additions & 0 deletions docs/builtin.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Built-in Settings and Capabilities
==================================

.. currentmodule:: singer_sdk.helpers.capabilities

The Singer SDK library provides a number of built-in settings and capabilities.

.. autodata:: ADD_RECORD_METADATA
:no-value:

.. autoattribute:: ADD_RECORD_METADATA.schema

.. autodata:: BATCH
:no-value:

.. autoattribute:: BATCH.schema
.. autoattribute:: BATCH.capability
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ within the `#singer-tap-development`_ and `#singer-target-development`_ Slack ch
implementation/index
typing
capabilities
builtin

.. toctree::
:caption: Advanced Concepts
Expand Down
4 changes: 2 additions & 2 deletions singer_sdk/connectors/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from singer_sdk import typing as th
from singer_sdk._singerlib import CatalogEntry, MetadataMapping, Schema
from singer_sdk.exceptions import ConfigValidationError
from singer_sdk.helpers.capabilities import TargetLoadMethods
from singer_sdk.helpers import capabilities

if t.TYPE_CHECKING:
from sqlalchemy.engine import Engine
Expand Down Expand Up @@ -779,7 +779,7 @@ def prepare_table(
as_temp_table=as_temp_table,
)
return
if self.config["load_method"] == TargetLoadMethods.OVERWRITE:
if self.config["load_method"] == capabilities.TargetLoadMethods.OVERWRITE:
self.get_table(full_table_name=full_table_name).drop(self._engine)
self.create_empty_table(
full_table_name=full_table_name,
Expand Down
Loading

0 comments on commit 5b4a7e6

Please sign in to comment.