Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AirbyteLib: fix examples in getting started #34762

Merged
merged 1 commit into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions airbyte-lib/examples/run_faker.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@

source = ab.get_connector(
"source-faker",
pip_url="-e ../airbyte-integrations/connectors/source-faker",
config={"count": SCALE / 2},
install_if_missing=True,
)
source.check()
source.set_streams(["products", "users", "purchases"])

cache = ab.new_local_cache()
result = source.read(cache)
result = source.read()

for name, records in result.cache.streams.items():
for name, records in result.streams.items():
print(f"Stream {name}: {len(list(records))} records")
16 changes: 6 additions & 10 deletions docs/using-airbyte/airbyte-lib/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pip install airbyte-lib
Or during the beta, you may want to install the latest from from source with:

```bash
pip install 'git+airbytehq/airbyte.git@master#egg=airbyte-lib&subdirectory=airbyte-lib'
pip install 'git+https://www.github.com/airbytehq/airbyte.git@master#egg=airbyte-lib&subdirectory=airbyte-lib'
```

## Usage
Expand All @@ -24,19 +24,15 @@ Data can be extracted from sources and loaded into caches:
import airbyte_lib as ab

source = ab.get_connector(
"source-spacex-api",
config={"id": "605b4b6aaa5433645e37d03f"},
"source-faker",
config={"count": 5_000},
install_if_missing=True,
)
source.check()
result = source.read()

source.set_streams(["launches", "rockets", "capsules"])

cache = ab.new_local_cache()
result = source.read_all(cache)

for name, records in result.cache.streams.items():
print(f"Stream {name}: {len(records)} records")
for name, records in result.streams.items():
print(f"Stream {name}: {len(list(records))} records")
```

## API Reference
Expand Down
Loading