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

feat(data-warehouse): add salesforce integration #23212

Merged
merged 64 commits into from
Aug 13, 2024

Conversation

EDsCODE
Copy link
Member

@EDsCODE EDsCODE commented Jun 24, 2024

Problem

  • no salesforce integration

Changes

  • adjusts the incremental fields api so that if there are no incremental fields, the set up button still works
  • adds salesforce integration flow
  • had to modify the onboarding flow slightly because for salesforce, a team needs to give us their subdomain first

TODO:

  • decide on how to import custom columns too , right now it's all standard columns. Custom columns require you to provide a limit
  • set client app id and secret in charts

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Does this work well for both Cloud and self-hosted?

How did you test this code?

Copy link
Contributor

github-actions bot commented Jun 24, 2024

Size Change: 0 B

Total Size: 1.07 MB

ℹ️ View Unchanged
Filename Size
frontend/dist/toolbar.js 1.07 MB

compressed-size-action

"q": {
"type": "incremental",
"cursor_path": "SystemModstamp",
"initial_value": "SELECT FIELDS(STANDARD) FROM Account WHERE SystemModstamp > 2000-01-01T00:00:00.000+0000",
Copy link
Member Author

@EDsCODE EDsCODE Jun 25, 2024

Choose a reason for hiding this comment

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

Unclear how to do incremental with this rest query format. I tried to do this but initial_value needs to match the cursor_path type i believe and cursor_path in this case is a datetime.

Oddly enough, the data does return but dlt doesn't write it

@Gilbert09

Copy link

Choose a reason for hiding this comment

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

Hey @EDsCODE,

initial_value needs to match the cursor_path type i believe and cursor_path in this case is a datetime.

This is true. We're going to allow data conversion for the incremental params, here's the issue: dlt-hub/verified-sources#507

Please take a look to see if the proposed solution fits. Do we miss anything?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, having a custom function to map the types/parameters would be great.

I think the suggestion in the issue would be enough for my case as we would be receiving a timestamp field and I'd be transforming it into the full query to pass back in

Copy link

Choose a reason for hiding this comment

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

@EDsCODE the PR with this feature has been merged: dlt-hub/verified-sources#515
Please give it a go. We'll document it soon as well.

@posthog-bot
Copy link
Contributor

This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week.

@posthog-bot
Copy link
Contributor

This PR was closed due to lack of activity. Feel free to reopen if it's still relevant.

@EDsCODE EDsCODE reopened this Aug 1, 2024
@EDsCODE EDsCODE removed the stale label Aug 1, 2024
@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

2 snapshot changes in total. 0 added, 2 modified, 0 deleted:

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

1 snapshot changes in total. 0 added, 1 modified, 0 deleted:

  • chromium: 0 added, 1 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@EDsCODE EDsCODE marked this pull request as ready for review August 12, 2024 03:48
Copy link
Member

@Gilbert09 Gilbert09 left a comment

Choose a reason for hiding this comment

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

Rest source stuff mostly looks good - need to figure out refresh tokens and maybe make the UI changes through config

Comment on lines +763 to +783
addToSalesforceButtonUrl: [
(s) => [s.preflight],
(preflight) => {
return (subdomain: string) => {
const clientId = preflight?.data_warehouse_integrations?.salesforce.client_id

if (!clientId) {
return null
}

const params = new URLSearchParams()
params.set('client_id', clientId)
params.set('redirect_uri', `${window.location.origin}/data-warehouse/salesforce/redirect`)
params.set('response_type', 'code')
params.set('scope', 'refresh_token api')
params.set('state', subdomain)

return `https://${subdomain}.my.salesforce.com/services/oauth2/authorize?${params.toString()}`
}
},
],
Copy link
Member

Choose a reason for hiding this comment

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

Nice to have: to use Bens new oauth stuff he added - although there is certainly a larger piece of work around how we do credentials, so may not be one for now. e.g. storing S3 details, or Stripe connection details, etc.

frontend/src/scenes/data-warehouse/new/NewSourceWizard.tsx Outdated Show resolved Hide resolved
requirements.in Outdated
@@ -59,7 +59,7 @@ posthoganalytics==3.5.0
psycopg2-binary==2.9.7
PyMySQL==1.1.1
psycopg[binary]==3.1.18
pyarrow==15.0.0
pyarrow==17.0.0
Copy link
Member

Choose a reason for hiding this comment

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

Any breaking changes with 2 new major versions of pyarrow?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not on dw end. DLT with delta requires it now

@tomasfarias note here incase of batch exports impact

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed these updates altogether. Realized they weren't needed. Also, note that the DLT version upgrade causes a test to fail. Errors about s3 configuring missing

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

2 snapshot changes in total. 0 added, 2 modified, 0 deleted:

  • chromium: 0 added, 2 modified, 0 deleted (wasn't pushed!)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

2 snapshot changes in total. 0 added, 2 modified, 0 deleted:

  • chromium: 0 added, 2 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

2 snapshot changes in total. 0 added, 2 modified, 0 deleted:

  • chromium: 0 added, 2 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

2 snapshot changes in total. 0 added, 2 modified, 0 deleted:

  • chromium: 0 added, 2 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

4 snapshot changes in total. 0 added, 4 modified, 0 deleted:

  • chromium: 0 added, 4 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

2 snapshot changes in total. 0 added, 2 modified, 0 deleted:

  • chromium: 0 added, 2 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

2 snapshot changes in total. 0 added, 2 modified, 0 deleted:

  • chromium: 0 added, 2 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

2 snapshot changes in total. 0 added, 2 modified, 0 deleted:

  • chromium: 0 added, 2 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

2 snapshot changes in total. 0 added, 2 modified, 0 deleted:

  • chromium: 0 added, 2 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

2 snapshot changes in total. 0 added, 2 modified, 0 deleted:

  • chromium: 0 added, 2 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@EDsCODE EDsCODE merged commit 7131400 into master Aug 13, 2024
93 checks passed
@EDsCODE EDsCODE deleted the dw-salesforce-integration branch August 13, 2024 21:30
EDsCODE added a commit that referenced this pull request Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants