Skip to content

Commit

Permalink
Source Faker: Enable zero-config execution by making 'count' an optio…
Browse files Browse the repository at this point in the history
…nal config param (#36167)
  • Loading branch information
aaronsteers committed Mar 21, 2024
1 parent 558ead6 commit 80456ef
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 51 deletions.
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-faker/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ data:
connectorSubtype: api
connectorType: source
definitionId: dfd88b22-b603-4c3d-aad7-3701784586b1
dockerImageTag: 6.0.2
dockerImageTag: 6.0.3
dockerRepository: airbyte/source-faker
documentationUrl: https://docs.airbyte.com/integrations/sources/faker
githubIssueLabel: source-faker
Expand Down
79 changes: 34 additions & 45 deletions airbyte-integrations/connectors/source-faker/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions airbyte-integrations/connectors/source-faker/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = [ "poetry-core>=1.0.0",]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
version = "6.0.2"
version = "6.0.3"
name = "source-faker"
description = "Source implementation for fake but realistic looking data."
authors = [ "Airbyte <evan@airbyte.io>",]
Expand All @@ -17,7 +17,7 @@ include = "source_faker"

[tool.poetry.dependencies]
python = "^3.9,<3.12"
airbyte-cdk = "==0.62.1"
airbyte-cdk = "^0.73.0"
mimesis = "==6.1.1"

[tool.poetry.scripts]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

from .streams import Products, Purchases, Users

DEFAULT_COUNT = 1_000


class SourceFaker(AbstractSource):
def check_connection(self, logger: AirbyteLogger, config: Mapping[str, Any]) -> Tuple[bool, Any]:
Expand All @@ -19,7 +21,7 @@ def check_connection(self, logger: AirbyteLogger, config: Mapping[str, Any]) ->
return False, "Count option is missing"

def streams(self, config: Mapping[str, Any]) -> List[Stream]:
count: int = config["count"] if "count" in config else 0
count: int = config["count"] if "count" in config else DEFAULT_COUNT
seed: int = config["seed"] if "seed" in config else None
records_per_slice: int = config["records_per_slice"] if "records_per_slice" in config else 100
always_updated: bool = config["always_updated"] if "always_updated" in config else True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Faker Source Spec",
"type": "object",
"required": ["count"],
"required": [],
"additionalProperties": true,
"properties": {
"count": {
"title": "Count",
"description": "How many users should be generated in total. This setting does not apply to the purchases or products stream.",
"description": "How many users should be generated in total. The purchases table will be scaled to match, with 10 purchases created per 10 users. This setting does not apply to the products stream.",
"type": "integer",
"minimum": 1,
"default": 1000,
Expand Down
Loading

0 comments on commit 80456ef

Please sign in to comment.