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

[Databricks] Preprocess Arrays before COPY INTO #1084

Merged
merged 5 commits into from
Dec 18, 2024

Conversation

Tang8330
Copy link
Contributor

@Tang8330 Tang8330 commented Dec 16, 2024

We need to preprocess arrays before we load it into Databricks.

@Tang8330 Tang8330 changed the title [WIP] Checkpoint. [Databricks] Preprocessing columns Dec 16, 2024
@Tang8330 Tang8330 changed the title [Databricks] Preprocessing columns [Databricks] Preprocessing arrays before COPY INTO Dec 16, 2024
@Tang8330 Tang8330 changed the title [Databricks] Preprocessing arrays before COPY INTO [Databricks] Preprocess Arrays before COPY INTO Dec 16, 2024
@Tang8330 Tang8330 marked this pull request as ready for review December 16, 2024 06:18
@Tang8330 Tang8330 requested a review from a team as a code owner December 16, 2024 06:18
// Copy file from DBFS -> table via COPY INTO, ref: https://docs.databricks.com/en/sql/language-manual/delta-copy-into.html
// We'll need \\\\N here because we need to string escape.
copyCommand := fmt.Sprintf(`COPY INTO %s BY POSITION FROM '%s' FILEFORMAT = CSV FORMAT_OPTIONS ('escape' = '"', 'delimiter' = '\t', 'header' = 'false', 'nullValue' = '\\\\N')`, tempTableID.FullyQualifiedName(), file.DBFSFilePath())
copyCommand := fmt.Sprintf(`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ran sql format so it's more legible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only change here is (SELECT %s FROM '%s')

@Tang8330 Tang8330 merged commit 5cc8dcb into master Dec 18, 2024
3 checks passed
@Tang8330 Tang8330 deleted the preprocess-databricks-columns branch December 18, 2024 05:09
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.

2 participants