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

Add a snowflake load options #1516

Merged
merged 10 commits into from
Jan 10, 2023
Merged

Conversation

dimberman
Copy link
Collaborator

@dimberman dimberman commented Jan 3, 2023

Description

What is the current behavior?

The current behavior for loading data to Snowflake is to depend on native_kwargs, which are loosely defined and lack type safety. There is also no way to specify FILE_FORMAT options in Snowflake, which can block users from being able to load their data.

What is the new behavior?

This PR introduces a SnowflakeLoadOptions class that contains file_format_options and copy_options fields. These fields allow users to specify the necessary arguments to correctly load their data.

Does this introduce a breaking change?

No, this does not introduce a breaking change.

Checklist

  • Created tests which fail without the change (if possible)
  • Extended the README / documentation, if necessary

@dimberman dimberman linked an issue Jan 3, 2023 that may be closed by this pull request
9 tasks
@codecov
Copy link

codecov bot commented Jan 3, 2023

Codecov Report

Base: 94.00% // Head: 94.03% // Increases project coverage by +0.03% 🎉

Coverage data is based on head (e88512c) compared to base (116cf74).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1516      +/-   ##
==========================================
+ Coverage   94.00%   94.03%   +0.03%     
==========================================
  Files          89       89              
  Lines        4368     4390      +22     
  Branches      432      438       +6     
==========================================
+ Hits         4106     4128      +22     
  Misses        178      178              
  Partials       84       84              
Impacted Files Coverage Δ
python-sdk/src/astro/databases/base.py 96.00% <ø> (ø)
python-sdk/src/astro/databases/aws/redshift.py 94.07% <100.00%> (+0.04%) ⬆️
python-sdk/src/astro/databases/google/bigquery.py 90.09% <100.00%> (+0.04%) ⬆️
python-sdk/src/astro/databases/snowflake.py 95.19% <100.00%> (+0.21%) ⬆️
python-sdk/src/astro/options.py 90.90% <100.00%> (+10.90%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@dimberman dimberman marked this pull request as ready for review January 6, 2023 00:52
python-sdk/src/astro/databases/base.py Outdated Show resolved Hide resolved
python-sdk/src/astro/databases/snowflake.py Show resolved Hide resolved
python-sdk/src/astro/options.py Show resolved Hide resolved
Copy link
Contributor

@pankajastro pankajastro left a comment

Choose a reason for hiding this comment

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

does it make sense to add one example in our docs? for example how can users set file_format (RECORD_DELIMITER in case of CSV) using the SnowflakeLoadOptions file_options param?

@astronomer astronomer deleted a comment from pankajkoti Jan 9, 2023
@dimberman
Copy link
Collaborator Author

@pankajastro I've created a ticket for wider documentation around LoadOptions. I don't want to hold up the 1.4 release over this so I think it's fine to do a more thorough job here. #1556

@dimberman dimberman merged commit acd7ee4 into main Jan 10, 2023
@dimberman dimberman deleted the load_options/snowflake_load_options branch January 10, 2023 00:56
utkarsharma2 pushed a commit that referenced this pull request Jan 17, 2023
# Description
## What is the current behavior?
The current behavior for loading data to Snowflake is to depend on
`native_kwargs`, which are loosely defined and lack type safety. There
is also no way to specify `FILE_FORMAT` options in Snowflake, which can
block users from being able to load their data.

## What is the new behavior?
This PR introduces a `SnowflakeLoadOptions` class that contains
`file_format_options` and `copy_options` fields. These fields allow
users to specify the necessary arguments to correctly load their data.

## Does this introduce a breaking change?
No, this does not introduce a breaking change.

### Checklist
- [ ] Created tests which fail without the change (if possible)
- [ ] Extended the README / documentation, if necessary
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.

Add Format Type Options (formatTypeOptions) for Snowflake
5 participants