Skip to content

Commit

Permalink
Add erd_url to registry in metadata service (#43971)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxi297 authored Aug 13, 2024
1 parent 62483b0 commit b775298
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ class Config:
)
releaseDate: Optional[date] = Field(None, description="The date when this connector was first released, in yyyy-mm-dd format.")
protocolVersion: Optional[str] = Field(None, description="the Airbyte Protocol version supported by the connector")
erdUrl: Optional[str] = Field(None, description="The URL where you can visualize the ERD")
connectorSubtype: Literal["api", "database", "datalake", "file", "custom", "message_queue", "unknown", "vectorstore"]
releaseStage: ReleaseStage
supportLevel: Optional[SupportLevel] = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ class Config:
maxSecondsBetweenMessages: Optional[int] = Field(
None, description="Number of seconds allowed between 2 airbyte protocol messages. The source will timeout if this delay is reach"
)
erdUrl: Optional[str] = Field(None, description="The URL where you can visualize the ERD")
releases: Optional[ConnectorReleases] = None
ab_internal: Optional[AirbyteInternal] = None
generated: Optional[GeneratedFields] = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ class Config:
maxSecondsBetweenMessages: Optional[int] = Field(
None, description="Number of seconds allowed between 2 airbyte protocol messages. The source will timeout if this delay is reach"
)
erdUrl: Optional[str] = Field(None, description="The URL where you can visualize the ERD")
releases: Optional[ConnectorReleases] = None
ab_internal: Optional[AirbyteInternal] = None
generated: Optional[GeneratedFields] = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ properties:
protocolVersion:
type: string
description: the Airbyte Protocol version supported by the connector
erdUrl:
type: string
description: The URL where you can visualize the ERD
connectorSubtype:
type: string
enum:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ properties:
maxSecondsBetweenMessages:
description: Number of seconds allowed between 2 airbyte protocol messages. The source will timeout if this delay is reach
type: integer
erdUrl:
type: string
description: The URL where you can visualize the ERD
releases:
"$ref": ConnectorReleases.yaml
ab_internal:
Expand Down
2 changes: 1 addition & 1 deletion airbyte-ci/connectors/metadata_service/lib/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "metadata-service"
version = "0.10.0"
version = "0.10.1"
description = ""
authors = ["Ben Church <ben@airbyte.io>"]
readme = "README.md"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@

@pytest.fixture
def metadata_definition():
metadata_file_url = "https://raw.githubusercontent.com/airbytehq/airbyte/8f0a6afe41cd1f9e70e954255749b7867592f863/airbyte-integrations/connectors/source-faker/metadata.yaml"
metadata_file_url = (
"https://raw.githubusercontent.com/airbytehq/airbyte/master/airbyte-integrations/connectors/source-faker/metadata.yaml"
)
response = requests.get(metadata_file_url)
response.raise_for_status()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,7 @@ def metadata_to_registry_entry(metadata_entry: LatestMetadataEntry, override_reg
"""Convert the metadata definition to a registry entry.
Args:
metadata_definition (dict): The metadata definition.
connector_type (str): One of "source" or "destination".
metadata_entry (LatestMetadataEntry): The metadata definition.
override_registry_key (str): The key of the registry to override the metadata with.
Returns:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "orchestrator"
version = "0.2.0"
version = "0.2.1"
description = ""
authors = ["Ben Church <ben@airbyte.io>"]
readme = "README.md"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9109,6 +9109,7 @@
"custom": false,
"releaseStage": "generally_available",
"protocolVersion": "0.2.0",
"erdUrl": "https://dbdocs.io/maximec5e237b90b/source-facebook-marketing",
"allowedHosts": {
"hosts": ["graph.facebook.com"]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13544,6 +13544,7 @@
"public": true,
"custom": false,
"releaseStage": "generally_available",
"erdUrl": "https://dbdocs.io/maximec5e237b90b/source-facebook-marketing",
"allowedHosts": {
"hosts": ["graph.facebook.com"]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,26 @@ def test_source_type_extraction():
assert result["sourceType"] == "database"


def test_erd_url():
"""
Test that if when defined in the metadata, the erd_url will be populated in the registry
"""
mock_metadata_entry = mock.Mock()
mock_metadata_entry.metadata_definition.dict.return_value = {
"data": {
"connectorType": "source",
"definitionId": "test-id",
"registryOverrides": {"oss": {"enabled": True}},
"erdUrl": "https://an-erd.com",
}
}
mock_metadata_entry.icon_url = "test-icon-url"
mock_metadata_entry.dependency_file_url = "test-dependency-file-url"

result = metadata_to_registry_entry(mock_metadata_entry, "oss")
assert result["erdUrl"] == "https://an-erd.com"


def test_support_level_default():
"""
Test if supportLevel is defaulted to alpha in the registry entry.
Expand Down

0 comments on commit b775298

Please sign in to comment.