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

Change load_options to list[LoadOptions] from LoadOptions #1540

Merged
merged 47 commits into from
Jan 10, 2023

Conversation

utkarsharma2
Copy link
Collaborator

@utkarsharma2 utkarsharma2 commented Jan 6, 2023

Description

What is the current behavior?

In load_file() we use multiple integrations with Pandas, and Databases at the same time. But We currently just have one parameter to pass in integration-specific parameters.

closes: #1532

What is the new behavior?

We have changed load_options params to List[LoadOptions] so that we can pass multiple integration parameters in a list.
Passing multiple values to load_options leads to the problem of mapping. How do we know that PandasLoadOptions need to be passed to dataframe specific methods?

We solved the mapping problem by having integration classes having LOAD_OPTIONS_CLASS_NAME parameter to store the LoadOptions subclass for that integration and initialize the File-type, File-location, and Database objects with the right LoadOption class.

Does this introduce a breaking change?

No, since we never released the load_options

Checklist

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

@codecov
Copy link

codecov bot commented Jan 6, 2023

Codecov Report

Base: 94.06% // Head: 94.17% // Increases project coverage by +0.11% 🎉

Coverage data is based on head (892884d) compared to base (79d69d9).
Patch coverage: 97.89% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1540      +/-   ##
==========================================
+ Coverage   94.06%   94.17%   +0.11%     
==========================================
  Files          89       89              
  Lines        4417     4450      +33     
  Branches      440      444       +4     
==========================================
+ Hits         4155     4191      +36     
+ Misses        178      174       -4     
- Partials       84       85       +1     
Impacted Files Coverage Δ
python-sdk/src/astro/files/types/__init__.py 84.84% <80.00%> (-1.36%) ⬇️
python-sdk/src/astro/databases/snowflake.py 94.92% <92.85%> (-0.27%) ⬇️
python-sdk/src/astro/databases/__init__.py 100.00% <100.00%> (ø)
python-sdk/src/astro/databases/aws/redshift.py 94.11% <100.00%> (+0.04%) ⬆️
python-sdk/src/astro/databases/base.py 96.00% <100.00%> (ø)
python-sdk/src/astro/databases/databricks/delta.py 91.42% <100.00%> (+1.28%) ⬆️
python-sdk/src/astro/databases/google/bigquery.py 90.13% <100.00%> (+0.04%) ⬆️
python-sdk/src/astro/databases/postgres.py 94.50% <100.00%> (+0.06%) ⬆️
python-sdk/src/astro/databases/sqlite.py 96.82% <100.00%> (+0.10%) ⬆️
python-sdk/src/astro/files/base.py 100.00% <100.00%> (ø)
... and 12 more

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.

@utkarsharma2 utkarsharma2 changed the title Change load options to list Change load_options to list[LoadOptions] from LoadOptions Jan 6, 2023
Copy link
Collaborator

@dimberman dimberman left a comment

Choose a reason for hiding this comment

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

I'll probably have more comments later but for now lets' address the first round of comments from @tatiana and I

python-sdk/conftest.py Show resolved Hide resolved
python-sdk/src/astro/databases/base.py Outdated Show resolved Hide resolved
python-sdk/src/astro/databricks/delta.py Outdated Show resolved Hide resolved
python-sdk/src/astro/dataframes/load_options.py Outdated Show resolved Hide resolved
python-sdk/src/astro/files/base.py Show resolved Hide resolved
@utkarsharma2 utkarsharma2 marked this pull request as ready for review January 9, 2023 09:24
@utkarsharma2 utkarsharma2 merged commit 8abfe45 into main Jan 10, 2023
@utkarsharma2 utkarsharma2 deleted the change_load_options branch January 10, 2023 13:09
utkarsharma2 added a commit that referenced this pull request Jan 17, 2023
# Description
## What is the current behavior?
In load_file() we use multiple integrations with Pandas, and Databases
at the same time. But We currently just have one parameter to pass in
integration-specific parameters.

closes: #1532

## What is the new behavior?
We have changed load_options params to List[LoadOptions] so that we can
pass multiple integration parameters in a list.
Passing multiple values to `load_options` leads to the problem of
mapping. How do we know that PandasLoadOptions need to be passed to
dataframe specific methods?

We solved the mapping problem by having integration classes having
`LOAD_OPTIONS_CLASS_NAME` parameter to store the `LoadOptions` subclass
for that integration and initialize the File-type, File-location, and
Database objects with the right LoadOption class.

## Does this introduce a breaking change?
No, since we never released the `load_options`

### Checklist
- [ ] Created tests which fail without the change (if possible)
- [ ] Extended the README / documentation, if necessary
utkarsharma2 added a commit that referenced this pull request Feb 8, 2023
# Description
## What is the current behavior?
load_options exposed to the user in File location/type added in the
following PR - #1540. Since
it's a derived property and not something the user should set.

Concerns
load_options shouldn't be exposed to the end users in the File class.
load_options is specific to load_file() and should not be part of
File/Databases.

closes: #1719


## What is the new behavior?
We added a getter/setter property on the File class such that the
load_option interface is not exposed to the end user.

## Does this introduce a breaking change?
Yes

### Checklist
- [ ] Created tests which fail without the change (if possible)
- [ ] Extended the README / documentation, if necessary
utkarsharma2 added a commit that referenced this pull request Feb 8, 2023
# Description
## What is the current behavior?
load_options exposed to the user in File location/type added in the
following PR - #1540. Since
it's a derived property and not something the user should set.

Concerns
load_options shouldn't be exposed to the end users in the File class.
load_options is specific to load_file() and should not be part of
File/Databases.

closes: #1719


## What is the new behavior?
We added a getter/setter property on the File class such that the
load_option interface is not exposed to the end user.

## Does this introduce a breaking change?
Yes

### 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.

Change load_options to accept list
4 participants