-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
🎉 Source Orb: enrich credits ledger entries with cost basis data, description, and update expiration date fields #11528
🎉 Source Orb: enrich credits ledger entries with cost basis data, description, and update expiration date fields #11528
Conversation
This PR is still a work in progress, I'll comment here when it's ready for review. |
@anushree-agrawal ping me when the PR is ready to review. Thanks for your contribution! |
@marcosmarxm this is ready for review now! Thanks for taking a look. |
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.
A few comments
ledger_entry_record["block_expiry_date"] = nested_expiry_date | ||
ledger_entry_record["per_unit_cost_basis"] = nested_per_unit_cost_basis |
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.
ledger_entry_record["block_expiry_date"] = nested_expiry_date | |
ledger_entry_record["per_unit_cost_basis"] = nested_per_unit_cost_basis | |
ledger_entry_record["credit_block_expiry_date"] = nested_expiry_date | |
ledger_entry_record["credit_block_per_unit_cost_basis"] = nested_per_unit_cost_basis |
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.
@marcosmarxm Thanks for the suggestion! I believe renaming block_expiry_date
to credit_block_expiry_date
might cause some issues since we already expose this field on the ledger_entry_record
and we're just changing where in the response shape we're pulling the data from.
I can rename per_unit_cost_basis
safely though, since that's a net-new field.
@@ -239,7 +239,9 @@ def request_params(self, stream_state: Mapping[str, Any], stream_slice: Mapping[ | |||
is of the same format as the stream_state of a regular incremental stream. | |||
""" | |||
current_customer_state = stream_state.get(stream_slice["customer_id"], {}) | |||
return super().request_params(current_customer_state, **kwargs) | |||
params = super().request_params(current_customer_state, **kwargs) | |||
params["entry_status"] = "committed" |
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.
Can you add to docstring of the class or the function why you're getting only committed
records?
@anushree-agrawal can you run |
del ledger_entry_record["credit_block"] | ||
ledger_entry_record["block_expiry_date"] = nested_expiry_date | ||
ledger_entry_record["credit_block_per_unit_cost_basis"] = nested_per_unit_cost_basis | ||
|
||
return ledger_entry_record |
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.
@anushree-agrawal would be nice to have a unit test to validate the data transformation here. wydt?
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.
Sure, I'll add one!
Thanks for the review!
|
/test connector=connectors/source-orb
|
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.
@anushree-agrawal can you bump the version of the connector inside the airbyte-config/init/.../resources/seed in source_definitions.yml and source_specs.yml files?
/publish connector=connectors/source-orb auto-bump-version=false
|
Thanks @marcosmarxm, just bumped the version |
…cription, and update expiration date fields (#11528) * Add cost basis data to connector and remap block_expiry_date field * Update dockerfile and orb.md * Update orb.md and comments * Add entry_status=committed as filter for getting CreditLedgerEntries * Update version information * Move entry_status filter to the correct endpoint * PR feedback: rename field and add docstring for committed entries * Fix unit tests to include entry_status param * Add a unit test to validate transform behavior * Format using gradlew format * Bump connector veresion in spec and definitions
What
This PR enriches the Orb source connector's credits ledger entries with newly added cost basis data and description fields.
We also pull the
block_expiry_date
from a serializedcredit_block
object now, instead of pulling it off thecredit_ledger_entry
object itself.We also filter to only return ledger entries that have a status of
committed
.How
We've added the new cost basis and description fields to the underlying Orb API, and we now parse those fields in the connector. The Orb source API has also been updated to return
expiry_date
as part of a nestedcredit_block
object, which we now unwrap and map toblock_expiry_date
in the connector.The Orb source API has also been updated to filter ledger entries based on status.
Recommended reading order
credits_ledger_entries.json
source.py
🚨 User Impact 🚨
Are there any breaking changes? What is the end result perceived by the user? If yes, please merge this PR with the 🚨🚨 emoji so changelog authors can further highlight this if needed.
Changes are all additive, so do not expect any user impact.
Pre-merge Checklist
Expand the relevant checklist and delete the others.
Updating a connector
Community member or Airbyter
airbyte_secret
./gradlew :airbyte-integrations:connectors:<name>:integrationTest
.README.md
bootstrap.md
. See description and examplesdocs/integrations/<source or destination>/<name>.md
including changelog. See changelog exampleAirbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.
/test connector=connectors/<name>
command is passing/publish
command described hereTests
Unit
Acceptance