You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add improvements to "Building a connector the hard way" (#19093)
* Add improvements to "Building a connector the hard way"
* add log_error() formatting to pass SAT tests
* Update to new version of acceptance-test-config.yml
* Edit tutorial directory to match tutorial
* Change permissions on acceptance-test-docker.sh
This reverts commit 40b2d98.
You may be wondering why `config` is a required input to `discover` if it's not used. This is done for consistency: the Airbyte Specification requires `--config` as an input to `discover` because many sources require it \(e.g: to discover the tables available in a Postgres database, you must supply a password\). So instead of guessing whether the flag is required depending on the connector, we always assume it is required, and the connector can choose whether to use it.
420
438
421
439
The full run method is now below:
@@ -526,14 +544,16 @@ First, let's create a configured catalog `fullrefresh_configured_catalog.json` t
526
544
Then we'll define the `read` method in `source.py`:
# In a real scenario we'd handle this error better :)
558
-
log("Failure occurred when calling Polygon.io API")
578
+
log_error("Failure occurred when calling Polygon.io API")
559
579
sys.exit(1)
560
580
else:
561
581
# Stock prices are returned sorted by date in ascending order
@@ -568,6 +588,8 @@ def read(config, catalog):
568
588
print(json.dumps(output_message))
569
589
```
570
590
591
+
Note we've added a `log_error()` function to simplify formatting error messages from within connector functions as [`AirbyteTraceMessage`](https://docs.airbyte.com/understanding-airbyte/airbyte-protocol#airbytetracemessage)s, specifically `AirbyteErrorTraceMessage`s.
592
+
571
593
After doing some input validation, the code above calls the API to obtain daily prices for the input stock ticker, then outputs the prices. As always, our output is formatted according to the Airbyte Specification. Let's update our args parser with the following blocks:
@@ -915,7 +949,7 @@ Then we can run the image using:
915
949
docker run airbyte/source-stock-ticker-api:dev
916
950
```
917
951
918
-
to run any of our commands, we'll need to mount all the inputs into the Docker container first, then refer to their _mounted_ paths when invoking the connector. For example, we'd run `check` or `read` as follows:
952
+
To run any of our commands, we'll need to mount all the inputs into the Docker container first, then refer to their _mounted_ paths when invoking the connector. This allows the connector to access your secrets without having to build them into the container. For example, we'd run `check` or `read` as follows:
919
953
920
954
```bash
921
955
$ docker run airbyte/source-stock-ticker-api:dev spec
@@ -948,25 +982,31 @@ The code generator should have already generated a YAML file which configures th
948
982
# See [Source Acceptance Tests](https://docs.airbyte.io/connector-development/testing-connectors/source-acceptance-tests-reference)
949
983
# for more information about how to configure these tests
@@ -1058,7 +1098,7 @@ airbyte-server | Version: dev
1058
1098
airbyte-server |
1059
1099
```
1060
1100
1061
-
After you see the above banner printed out in the terminal window where you are running `docker-compose up`, visit [http://localhost:8000](http://localhost:8000) in your browser.
1101
+
After you see the above banner printed out in the terminal window where you are running `docker-compose up`, visit [http://localhost:8000](http://localhost:8000) in your browser and log in with the default credentials: username `airbyte` and password `password`.
1062
1102
1063
1103
If this is the first time using the Airbyte UI, then you will be prompted to go through a first-time wizard. To skip it, click the "Skip Onboarding" button.
0 commit comments