Skip to content

Commit 67502d5

Browse files
authored
Fix: Misc cleanup (#317)
1 parent 1bcb440 commit 67502d5

File tree

17 files changed

+23
-55
lines changed

17 files changed

+23
-55
lines changed

airbyte/__init__.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
2-
"""PyAirbyte brings Airbyte ELT to every Python developer.
3-
4-
PyAirbyte brings the power of Airbyte to every Python developer. PyAirbyte provides a set of
5-
utilities to use Airbyte connectors in Python.
2+
"""***PyAirbyte brings the power of Airbyte to every Python developer.***
63
74
[![PyPI version](https://badge.fury.io/py/airbyte.svg)](https://badge.fury.io/py/airbyte)
85
[![PyPI - Downloads](https://img.shields.io/pypi/dm/airbyte)](https://pypi.org/project/airbyte/)
@@ -121,7 +118,7 @@
121118
122119
----------------------
123120
124-
"""
121+
""" # noqa: D415
125122

126123
from __future__ import annotations
127124

airbyte/_connector_base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,6 @@ def _yaml_spec(self) -> str:
230230
@property
231231
def docs_url(self) -> str:
232232
"""Get the URL to the connector's documentation."""
233-
# TODO: Replace with docs URL from metadata when available
234233
return (
235234
f"https://docs.airbyte.com/integrations/{self.connector_type}s/"
236235
+ self.name.lower().replace(f"{self.connector_type}-", "")

airbyte/_executors/declarative.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class DeclarativeExecutor(Executor):
4040

4141
def __init__(
4242
self,
43-
manifest: str | dict | Path,
43+
manifest: dict | Path,
4444
) -> None:
4545
"""Initialize a declarative executor.
4646
@@ -53,18 +53,17 @@ def __init__(
5353
if isinstance(manifest, Path):
5454
self._manifest_dict = cast(dict, json.loads(manifest.read_text()))
5555

56-
elif isinstance(manifest, str):
57-
# TODO: Implement HTTP path parsing
58-
raise NotImplementedError("HTTP path parsing is not yet implemented.")
59-
6056
elif isinstance(manifest, dict):
6157
self._manifest_dict = manifest
6258

6359
if not isinstance(self._manifest_dict, dict):
6460
raise PyAirbyteInternalError(message="Manifest must be a dict.")
6561

6662
self.declarative_source = ManifestDeclarativeSource(source_config=self._manifest_dict)
67-
self.reported_version: str | None = None # TODO: Consider adding version detection
63+
64+
# TODO: Consider adding version detection
65+
# https://github.com/airbytehq/airbyte/issues/318
66+
self.reported_version: str | None = None
6867

6968
@property
7069
def _cli(self) -> list[str]:

airbyte/_executors/local.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ def ensure_installation(
4141
try:
4242
self.execute(["spec"])
4343
except Exception as e:
44-
# TODO: Improve error handling. We should try to distinguish between
45-
# a connector that is not installed and a connector that is not
46-
# working properly.
4744
raise exc.AirbyteConnectorExecutableNotFoundError(
4845
connector_name=self.name,
4946
) from e

airbyte/_executors/python.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ def uninstall(self) -> None:
9898
@property
9999
def docs_url(self) -> str:
100100
"""Get the URL to the connector's documentation."""
101-
# TODO: Refactor installation so that this can just live in the Source class.
102101
return "https://docs.airbyte.com/integrations/sources/" + self.name.lower().replace(
103102
"source-", ""
104103
)

airbyte/_future_cdk/sql_processor.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,6 @@ def get_sql_table_name(
206206
) -> str:
207207
"""Return the name of the SQL table for the given stream."""
208208
table_prefix = self.sql_config.table_prefix
209-
210-
# TODO: Add default prefix based on the source name.
211-
212209
return self.normalizer.normalize(
213210
f"{table_prefix}{stream_name}",
214211
)
@@ -433,6 +430,7 @@ def _ensure_compatible_table_schema(
433430
input stream.
434431
"""
435432
# TODO: Expand this to check for column types and sizes.
433+
# https://github.com/airbytehq/pyairbyte/issues/321
436434
self._add_missing_columns_to_table(
437435
stream_name=stream_name,
438436
table_name=table_name,

airbyte/_processors/sql/postgres.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,6 @@ class PostgresSqlProcessor(SqlProcessorBase):
4848
or another import method. (Relatively low priority, since for now it works fine as-is.)
4949
"""
5050

51-
supports_merge_insert = False # TODO: Add native implementation for merge insert
51+
supports_merge_insert = False
5252
file_writer_class = JsonlWriter
5353
sql_config: PostgresConfig

airbyte/_util/api_util.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ def create_source(
254254
models.SourceCreateRequest(
255255
name=name,
256256
workspace_id=workspace_id,
257-
configuration=config, # TODO: wrap in a proper configuration object
257+
configuration=config,
258258
definition_id=None, # Not used alternative to config.sourceType.
259259
secret_id=None, # For OAuth, not yet supported
260260
),
@@ -337,7 +337,7 @@ def create_destination(
337337
models.DestinationCreateRequest(
338338
name=name,
339339
workspace_id=workspace_id,
340-
configuration=config, # TODO: wrap in a proper configuration object
340+
configuration=config,
341341
),
342342
)
343343
if status_ok(response.status_code) and response.destination_response:
@@ -368,6 +368,7 @@ def get_destination(
368368
if status_ok(response.status_code):
369369
# TODO: This is a temporary workaround to resolve an issue where
370370
# the destination API response is of the wrong type.
371+
# https://github.com/airbytehq/pyairbyte/issues/320
371372
raw_response: dict[str, Any] = json.loads(response.raw_response.text)
372373
raw_configuration: dict[str, Any] = raw_response["configuration"]
373374
destination_type = raw_response.get("destinationType")
@@ -538,10 +539,6 @@ def delete_connection(
538539
# api_key: str,
539540
# workspace_id: str | None = None,
540541
# ) -> api.SourceCheckResponse:
541-
# """Check a source.
542-
543-
# # TODO: Need to use legacy Configuration API for this:
544-
# # https://airbyte-public-api-docs.s3.us-east-2.amazonaws.com/rapidoc-api-docs.html#post-/v1/sources/check_connection
545-
# """
542+
# """Check a source."""
546543
# _ = source_id, workspace_id, api_root, api_key
547544
# raise NotImplementedError

airbyte/_util/document_rendering.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class DocumentRenderer(BaseModel):
4343
render_metadata: bool = False
4444

4545
# TODO: Add primary key and cursor key support:
46+
# https://github.com/airbytehq/pyairbyte/issues/319
4647
# primary_key_properties: list[str]
4748
# cursor_property: str | None
4849

@@ -72,13 +73,6 @@ def render_document(self, record: dict[str, Any]) -> Document:
7273
content += yaml.dump({key: record[key] for key in self.metadata_properties})
7374
content += "```\n"
7475

75-
# TODO: Add support for primary key and doc ID generation:
76-
# doc_id: str = (
77-
# "-".join(str(record[key]) for key in self.primary_key_properties)
78-
# if self.primary_key_properties
79-
# else str(hash(record))
80-
# )
81-
8276
if not self.content_properties:
8377
pass
8478
elif len(self.content_properties) == 1:

airbyte/caches/motherduck.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ def get_sql_alchemy_url(self) -> SecretString:
4848

4949
return SecretString(
5050
f"duckdb:///md:{self.database}?motherduck_token={self.api_key}"
51-
# f"&schema={self.schema_name}" # TODO: Debug why this doesn't work
51+
# Not sure why this doesn't work. We have to override later in the flow.
52+
# f"&schema={self.schema_name}"
5253
)
5354

5455
@overrides

0 commit comments

Comments
 (0)