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

🎉 New Source: Alpha Vantage #18320

Merged
merged 15 commits into from
Nov 3, 2022

Conversation

isaacharrisholt
Copy link
Contributor

@isaacharrisholt isaacharrisholt commented Oct 21, 2022

What

Alpha Vantage is one of the most popular stock price APIs, and it's completely free, making it a crucial part of many FinTech business' stacks. This PR adds an Alpha Vantage source to Airbyte.

It also contains an extended DpathExtractor that supports a new data format. This is explained in the docstring.

Hacktoberfest: airbytehq/connector-contest#222

How

Adds a source with the following streams:

  • time_series_intraday
  • time_series_daily
  • time_series_daily_adjusted
  • time_series_weekly
  • time_series_weekly_adjusted
  • time_series_monthly
  • time_series_monthly_adjusted

AV always returns the full history of an asset, so I have not implemented an incremental read for this source.

Recommended reading order

  1. alpha_vantage.yaml
  2. spec.yaml
  3. object_dpath_extractor.py
  4. test_object_dpath_extractor.py

🚨 User Impact 🚨

No changes to existing code.

Pre-merge Checklist

New Connector

Community member or Airbyter

  • Community member? Grant edit access to maintainers (instructions)
  • Secrets in the connector's spec are annotated with airbyte_secret
  • Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run ./gradlew :airbyte-integrations:connectors:<name>:integrationTest.
  • Code reviews completed
  • Documentation updated
    • Connector's README.md
    • Connector's bootstrap.md. See description and examples
    • docs/integrations/<source or destination>/<name>.md including changelog. See changelog example
    • docs/integrations/README.md
    • airbyte-integrations/builds.md
  • PR name follows PR naming conventions

Airbyter

If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.

  • Create a non-forked branch based on this PR and test the below items on it
  • Build is successful
  • If new credentials are required for use in CI, add them to GSM. Instructions.
  • /test connector=connectors/<name> command is passing
  • New Connector version released on Dockerhub by running the /publish command described here
  • After the connector is published, connector added to connector index as described here
  • Seed specs have been re-generated by building the platform and committing the changes to the seed spec files, as described here

Tests

Unit

image

Integration

image

Acceptance

image

@github-actions github-actions bot added the area/connectors Connector related issues label Oct 21, 2022
Copy link
Member

@marcosmarxm marcosmarxm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, it is missing the documentation can you add it? A few comments, but overal the implementatino is great.

@github-actions github-actions bot added the area/documentation Improvements or additions to documentation label Oct 25, 2022
Copy link
Member

@marcosmarxm marcosmarxm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments and it is ready to go! :)
Are you able to run ./gradlew airbyte-integrations:connectors:source-alpha-vantage:integrationTest my tests are failing.

Copy link
Member

@marcosmarxm marcosmarxm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the hardcode value the connector works. Let's see what is causing the issue with the options['function'] after that this is ready to be merged.

Comment on lines +20 to +27
request_parameters:
apikey: "{{ config['api_key'] }}"
symbol: "{{ config['symbol'] }}"
function: "{{ options['function'] }}"
datatype: json
outputsize: "{{ config['outputsize'] }}"
interval: "{{ config['interval'] }}"
adjusted: "{{ config['adjusted'] }}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small detail @isaacharrisholt.

@girarda I saw one bug with this connector:
https://www.alphavantage.co/query?apikey=****&symbol=IBM&datatype=json&outputsize=compact&interval=60min
The request parameter function is not added to the url. If I change the parameter to a hardcoded string it works fine, example TIME_SERIES_DAILY. Any idea?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marcosmarxm I think this is an issue that was solved recently. You might need to reinstall the CDK with the newest version.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll give a try, maybe I was using the wrong pyenv =p

@marcosmarxm
Copy link
Member

marcosmarxm commented Nov 1, 2022

/test connector=connectors/source-alpha-vantage

🕑 connectors/source-alpha-vantage https://github.com/airbytehq/airbyte/actions/runs/3369781521
❌ connectors/source-alpha-vantage https://github.com/airbytehq/airbyte/actions/runs/3369781521
🐛 https://gradle.com/s/wyeh3wxvnr4la

Build Failed

Test summary info:

=========================== short test summary info ============================
ERROR test_core.py::TestSpec::test_config_match_spec[inputs0] - FileNotFoundE...
ERROR test_core.py::TestConnection::test_check[inputs0] - FileNotFoundError: ...
ERROR test_core.py::TestDiscovery::test_discover[inputs0] - FileNotFoundError...
ERROR test_core.py::TestDiscovery::test_defined_cursors_exist_in_schema[inputs0]
ERROR test_core.py::TestDiscovery::test_defined_refs_exist_in_schema[inputs0]
ERROR test_core.py::TestDiscovery::test_defined_keyword_exist_in_schema[inputs0-allOf]
ERROR test_core.py::TestDiscovery::test_defined_keyword_exist_in_schema[inputs0-not]
ERROR test_core.py::TestDiscovery::test_primary_keys_exist_in_schema[inputs0]
ERROR test_core.py::TestDiscovery::test_streams_has_sync_modes[inputs0] - Fil...
ERROR test_core.py::TestDiscovery::test_additional_properties_is_true[inputs0]
ERROR test_core.py::TestBasicRead::test_read[inputs0] - FileNotFoundError: [E...
ERROR test_core.py::TestBasicRead::test_airbyte_trace_message_on_failure[inputs0]
ERROR test_full_refresh.py::TestFullRefresh::test_sequential_reads[inputs0]
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/plugin.py:60: Skipping TestIncremental.test_two_sequential_reads because not found in the config
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/tests/test_core.py:51: The previous connector image could not be retrieved.
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/tests/test_core.py:229: The previous connector image could not be retrieved.
================== 11 passed, 3 skipped, 13 errors in 12.68s ===================

@marcosmarxm
Copy link
Member

marcosmarxm commented Nov 1, 2022

/test connector=connectors/source-alpha-vantage

🕑 connectors/source-alpha-vantage https://github.com/airbytehq/airbyte/actions/runs/3370960427
✅ connectors/source-alpha-vantage https://github.com/airbytehq/airbyte/actions/runs/3370960427
Python tests coverage:

Name                                             Stmts   Miss  Cover
--------------------------------------------------------------------
source_alpha_vantage/__init__.py                     2      0   100%
source_alpha_vantage/object_dpath_extractor.py      31      2    94%
source_alpha_vantage/source.py                       4      1    75%
--------------------------------------------------------------------
TOTAL                                               37      3    92%
	 Name                                                 Stmts   Miss  Cover   Missing
	 ----------------------------------------------------------------------------------
	 source_acceptance_test/base.py                          10      4    60%   15-18
	 source_acceptance_test/config.py                        83      6    93%   78-80, 84-86
	 source_acceptance_test/conftest.py                     164    164     0%   6-282
	 source_acceptance_test/plugin.py                        48     48     0%   6-104
	 source_acceptance_test/tests/test_core.py              329    111    66%   39, 50-58, 63-70, 74-75, 79-80, 164, 202-219, 228-236, 240-245, 251, 284-289, 327-334, 377-379, 382, 442-451, 480-481, 487, 490, 523-533, 546-571, 576-580
	 source_acceptance_test/tests/test_incremental.py       145     20    86%   21-23, 29-31, 36-43, 48-61, 224
	 source_acceptance_test/utils/asserts.py                 37      2    95%   57-58
	 source_acceptance_test/utils/common.py                  77     10    87%   15-16, 24-30, 64, 67
	 source_acceptance_test/utils/compare.py                 62     23    63%   21-51, 68, 97-99
	 source_acceptance_test/utils/connector_runner.py       112     50    55%   23-26, 32, 36, 39-68, 71-73, 76-78, 81-83, 86-88, 91-93, 96-114, 148-150
	 source_acceptance_test/utils/json_schema_helper.py     105     13    88%   30-31, 38, 41, 65-68, 96, 120, 190-192
	 ----------------------------------------------------------------------------------
	 TOTAL                                                 1351    451    67%

Build Passed

Test summary info:

=========================== short test summary info ============================
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/plugin.py:60: Skipping TestIncremental.test_two_sequential_reads because not found in the config
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/tests/test_core.py:51: The previous connector image could not be retrieved.
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/tests/test_core.py:229: The previous connector image could not be retrieved.
======================== 24 passed, 3 skipped in 24.13s ========================

@marcosmarxm
Copy link
Member

marcosmarxm commented Nov 1, 2022

/publish connector=connectors/source-alpha-vantage

🕑 Publishing the following connectors:
connectors/source-alpha-vantage
https://github.com/airbytehq/airbyte/actions/runs/3371080658


Connector Did it publish? Were definitions generated?
connectors/source-alpha-vantage

if you have connectors that successfully published but failed definition generation, follow step 4 here ▶️

Copy link
Member

@marcosmarxm marcosmarxm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marcosmarxm marcosmarxm merged commit 606534d into airbytehq:master Nov 3, 2022
letiescanciano added a commit that referenced this pull request Nov 3, 2022
* master: (38 commits)
  New Source: Gridly (#18342)
  🎉 New Source: Alpha Vantage (#18320)
  ci_integration_test.sh: cut GITHUB_STEP_SUMMARY (#18895)
  🎉 New Source: Datadog [python cdk] (#18150)
  Hide Reject all button in consent dialog (#18596)
  feat: add doc url to track event (#18690)
  fix: install java in oss catalog deploy action (#18887)
  [CI] Speed up check_images_exist (#18873)
  Extract open API (#18879)
  Remove unused interfaces (#18880)
  add action for deploying oss connector catalog to GCS (#18633)
  feat: generate full connector catalog json (#18562)
  Add unsupported_protocol_version column to Connection (#18876)
  Extract OAuth API (#18818)
  update images to have non-transparent background (#18874)
  DiscoverSchema endpoints calculates diff and breaking change (#18571)
  Validate protocol version on connector update (#18639)
  Bmoric/extract notification api (#18812)
  Show version and changelog status for affected connectors (#18845)
  Bmoric/extract logs api (#18621)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants