-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Add source connector for the PokéAPI #3149
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! First connector 4 days in. Good stuff.
url_base = 'https://pokeapi.co/api/v2/' | ||
|
||
def __init__(self, name: str, **kwargs): | ||
super().__init__() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The best practice is to pass **kwargs
to the superclass
super().__init__() | |
super().__init__(**kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha, done!
|
||
def streams(self, config: Mapping[str, Any]) -> List[Stream]: | ||
args = {"name": config["name"]} | ||
return [Pokemon(**args)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bundling arguments into a dict like args
is usually useful when you need to pass those params as a group. In this case we can just pass it directly
return [Pokemon(**args)] | |
return [Pokemon(name=config["name"])] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me, done!
"required": ["TODO"], | ||
"additionalProperties": false, | ||
"properties": { | ||
"TODO: This schema defines the configuration required for the source. This usually involves metadata such as database and/or authentication information.": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the contents of ../spec.json
should be here, and that one should be deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"type": "object", | ||
"properties": { | ||
"name": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if I run curl https://pokeapi.co/api/v2/pokemon/pikachu
the schema looks way more complicated. This should include it. This allows downstream consumers to know how to format/normalize the data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep makes sense, done!
Told my kids about this connector, they had stars in their eyes! |
// configPath points to a config file which matches the spec.json supplied above. secrets/ is gitignored by default, so place your config file | ||
// there (in case it contains any credentials) | ||
// TODO update the config file to contain actual credentials | ||
configPath = "secrets/config.json" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you'll need to change this to sample_files/config.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed this comment for some reason! Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brilliant! to publish your connector with Airbyte by default you'll need to:
- Add a docs page in
docs/integrations/sources/poke-api.md
- Add a ref to the doc page in
docs/SUMMARY.md
- add an entry for this connector in
source_definitions.yaml
using a newly generated UUID - create a JSON file
airbyte-config/init/src/main/resources/config/STANDARD_DESTINATION_DEFINITION
with the same info as that in checkin catalogs #3 - on this PR, comment
/publish connector=connectors/source-pokeapi
- If that is green, merge
/publish connector=connectors/source-pokeapi
|
Main Changes
Endpoints Implemented
/pokemon
endpoint is implemented, allowing the user to retrieve one pokemon's relevant information from it.Notes/Self-Feedback