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) [nan-591] insert into bigQuery #1903

Merged
merged 16 commits into from Mar 29, 2024

Conversation

khaliqgant
Copy link
Member

Describe your changes

Add in BigQuery data ingestion from sync, actions, and webhooks

Issue ticket number and link

NAN-591

Checklist before requesting a review (skip if just adding/editing APIs & templates)

  • I added tests, otherwise the reason is:
  • I added observability, otherwise the reason is:
  • I added analytics, otherwise the reason is:

Copy link

linear bot commented Mar 25, 2024

@TBonnin
Copy link
Collaborator

TBonnin commented Mar 25, 2024

Can we start making dedicated packages for this kind of functionality instead of adding it into shared. Maybe inside /packages/internals/ to signifiy they will never be published?

@bastienbeurier
Copy link
Member

I wonder if there's a way to flag or exclude test data.

Random idea: accounts created with a @nango.dev email are flagged as test accounts in our main DB & excluded from tracking?

@khaliqgant khaliqgant marked this pull request as ready for review March 27, 2024 11:57
Copy link
Contributor

@bodinsamuel bodinsamuel left a comment

Choose a reason for hiding this comment

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

Minor comments, looks good otherwise 👌🏻

packages/shared/lib/services/sync/run.service.ts Outdated Show resolved Hide resolved
packages/shared/lib/services/sync/run.service.ts Outdated Show resolved Hide resolved
packages/shared/package.json Outdated Show resolved Hide resolved
packages/shared/lib/clients/big-query.client.ts Outdated Show resolved Hide resolved
packages/shared/lib/clients/big-query.client.ts Outdated Show resolved Hide resolved
packages/shared/lib/clients/big-query.client.ts Outdated Show resolved Hide resolved
packages/shared/lib/clients/big-query.client.ts Outdated Show resolved Hide resolved
packages/shared/lib/clients/big-query.client.ts Outdated Show resolved Hide resolved
packages/shared/lib/clients/big-query.client.ts Outdated Show resolved Hide resolved
packages/shared/lib/clients/big-query.client.ts Outdated Show resolved Hide resolved
insert(row: RunScriptRow): void;
}

interface RunScriptRow {
Copy link
Member Author

Choose a reason for hiding this comment

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

Don't love duplicated types but given our setup this is needed for now

Copy link
Contributor

@bodinsamuel bodinsamuel 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 (can't really test the code) 👌🏻

Maybe we can use optionalDependencies to avoid code duplication, so it would work locally with Typescript and there will be no ref about the type in the code after compilation.

Also it's missing on tsconfig.build.json

packages/data-ingestion/package.json Show resolved Hide resolved
packages/jobs/lib/activities.ts Show resolved Hide resolved
packages/data-ingestion/lib/index.ts Show resolved Hide resolved
content: string;
runTimeInSeconds: number;
createdAt: number;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

not a blocker: the schema is not linked to the type, which could lead to desync

const fields: { name: keyof RunScriptRow; type: 'STRING' | 'INTEGER' }[] = [
    { name: 'accountId', type: 'STRING' },
    { name: 'connectionId', type: 'STRING' }
];

packages/data-ingestion/lib/index.ts Outdated Show resolved Hide resolved
packages/shared/lib/services/sync/run.service.ts Outdated Show resolved Hide resolved
}
}

public async insert(data: RunScriptRow, tableName?: string) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since we are not enforcing type and schema matching, should insert simply accept any record<string, string|number>?

Copy link
Member Author

Choose a reason for hiding this comment

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

Won't work as then there would be a type mismatch between the two.

@khaliqgant khaliqgant merged commit 98bb60c into master Mar 29, 2024
18 checks passed
@khaliqgant khaliqgant deleted the khaliq/nan-591-implement-data-ingestion branch March 29, 2024 07:21
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.

None yet

4 participants