Skip to content

Commit

Permalink
Fix lint and update uri
Browse files Browse the repository at this point in the history
Signed-off-by: HH <[email protected]>
  • Loading branch information
hhcs9527 committed Sep 29, 2023
1 parent 306a33a commit f62da5c
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def get_subset_df(df: Annotated[StructuredDataset, subset_cols]) -> Annotated[St
# 3. Use [Key Pair Authentication](https://docs.snowflake.com/en/user-guide/key-pair-auth) to setup the connections with Snowflake.
# 4. run the following command to setup the secret
# ```bash
# kubectl create secret generic snowflake --namespace=flyte --from-literal=private_key={your_private_key_above}
# kubectl create secret generic snowflake --namespace=flytesnacks-development --from-file=private_key.pem={your_private_key_above}
# ```
# %% [markdown]
# Import the dependencies.
Expand Down Expand Up @@ -136,7 +136,9 @@ def pandas_to_sf() -> StructuredDataset:
# create a pandas dataframe
df = pd.DataFrame({"Name": ["Tom", "Joseph"], "Age": [20, 22]})
# convert the dataframe to StructuredDataset
return StructuredDataset(dataframe=df, uri="snowflake://<user>:<your_account>/<database>/<schema>/<warehouse>/<table>")
return StructuredDataset(
dataframe=df, uri="snowflake://<user>:<your_account>/<warehouse>/<database>/<schema>/<table>"
)


# %% [markdown]
Expand All @@ -152,9 +154,10 @@ def bq_to_pandas(sd: StructuredDataset) -> pd.DataFrame:
# convert to pandas dataframe
return sd.open(pd.DataFrame).all()


# %% [markdown]
# :::{note}
# The Snowflake uri's format is `snowflake://<user>:<your_account>/<database>/<schema>/<warehouse>/<table>`.
# The Snowflake uri's format is `snowflake://<user>:<your_account>/<warehouse>/<database>/<schema>/<table>`.
# :::

# %% [markdown]
Expand All @@ -178,7 +181,9 @@ def sf_to_pandas(sd: StructuredDataset) -> pd.DataFrame:
obj_bq_1 = bq_to_pandas(sd=StructuredDataset(uri="bq://sample-project-1-352610.sample_352610.test1"))
obj_bq_2 = pandas_to_bq()

obj_sf_1 = sf_to_pandas(sd=StructuredDataset(uri="snowflake://<user>:<your_account>/<database>/<schema>/<warehouse>/<table>"))
obj_sf_1 = sf_to_pandas(
sd=StructuredDataset(uri="snowflake://<user>:<your_account>/<warehouse>/<database>/<schema>/<table>")
)
obj_sf_2 = pandas_to_sf()


Expand Down

0 comments on commit f62da5c

Please sign in to comment.