Skip to content

Commit

Permalink
AirbyteLib: fix examples in getting started (airbytehq#34762)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronsteers authored and jatinyadav-cc committed Feb 21, 2024
1 parent 648757f commit 4d9cae9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
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

0 comments on commit 4d9cae9

Please sign in to comment.