Skip to content

Commit

Permalink
Update "Building a connector the hard way" doc (#9008)
Browse files Browse the repository at this point in the history
  • Loading branch information
edgao committed Dec 21, 2021
1 parent ddbce46 commit d0f9aa8
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Airbyte provides a code generator which bootstraps the scaffolding for our conne

```bash
$ cd airbyte-integrations/connector-templates/generator
$ ./generate.sh
$ ./generate.sh
```

We'll select the `generic` template and call the connector `stock-ticker-api`:
Expand Down Expand Up @@ -210,7 +210,7 @@ def run(args):
log("Invalid command. Allowable commands: [spec]")
sys.exit(1)

# A zero exit code means the process successfully completed
# A zero exit code means the process successfully completed
sys.exit(0)


Expand Down Expand Up @@ -287,7 +287,7 @@ Lastly we'll extend the `run` method to accept the `check` command and call the
def get_input_file_path(path):
if os.path.isabs(path):
return path
else:
else:
return os.path.join(os.getcwd(), path)
```

Expand Down Expand Up @@ -559,7 +559,7 @@ def read(config, catalog):
print(json.dumps(output_message))
```

After doing some input validation, the code above calls the API to obtain the last 7 days of prices for the input stock ticker, then outputs the prices in ascending order. As always, our output is formatted according to the Airbyte Specification. Let's update our args parser with the following blocks:
After doing some input validation, the code above calls the API to obtain the last 7 days of prices for the input stock ticker, then outputs the prices in ascending order (this is only for human-readability; real sources do not need to do this sorting). As always, our output is formatted according to the Airbyte Specification. Let's update our args parser with the following blocks:

```python
# Accept the read command
Expand Down Expand Up @@ -836,7 +836,7 @@ A full connector in less than 200 lines of code. Not bad! We're now ready to pac

Our connector is very lightweight, so the Dockerfile needed to run it is very light as well. We edit the autogenerated `Dockerfile` so that its contents are as followed:

```text
```Dockerfile
FROM python:3.7-slim

# We change to a directory unique to us
Expand All @@ -853,6 +853,10 @@ ENTRYPOINT ["python", "/airbyte/integration_code/source.py"]
# Airbyte's build system uses these labels to know what to name and tag the docker images produced by this Dockerfile.
LABEL io.airbyte.name=airbyte/source-stock-ticker-api
LABEL io.airbyte.version=0.1.0

# In order to launch a source on Kubernetes in a pod, we need to be able to wrap the entrypoint.
# The source connector must specify its entrypoint in the AIRBYTE_ENTRYPOINT variable.
ENV AIRBYTE_ENTRYPOINT='python /airbyte/integration_code/source.py'
```

Once we save the `Dockerfile`, we can build the image by running:
Expand Down Expand Up @@ -1058,8 +1062,8 @@ Armed with the knowledge you gained in this guide, here are some places you can
This section is not yet complete and will be completed soon. Please reach out to us on [Slack](https://slack.airbyte.io) or [Github](https://github.com/airbytehq/airbyte) if you need the information promised by these sections immediately.

### Incremental sync
Follow the [next tutorial](adding-incremental-sync.md) to implement incremental sync.
Follow the [next tutorial](adding-incremental-sync.md) to implement incremental sync.

### Connector Development Kit
Like we mention at the beginning of the tutorial, this guide is meant more for understanding than as a blueprint for implementing production connectors. See the [Connector Development Kit](../../../airbyte-cdk/python/docs/tutorials/README.md) for the frameworks you should use to build production-ready connectors.
Like we mention at the beginning of the tutorial, this guide is meant more for understanding than as a blueprint for implementing production connectors. See the [Connector Development Kit](../../../airbyte-cdk/python/docs/tutorials/README.md) for the frameworks you should use to build production-ready connectors.
/

0 comments on commit d0f9aa8

Please sign in to comment.