Skip to content

Commit

Permalink
fix: copy_options type
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoshi-Egawa committed Jun 25, 2024
1 parent 85cb3c7 commit 625519f
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions from snowflake.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
from snowflake.snowpark import Session

connection_parameters: dict[str, int | str] = {
"user": "<user_name>",
"password": "<password>",
"account": "<account_name>",
"role": "<role_name>",
"warehouse": "<warehouse_name>",
"database": "<database_name>",
"schema": "<schema_name>",
}

session = Session.builder.configs(connection_parameters).create()

df = session.create_dataframe(
[["John", "Berry"], ["Rick", "Berry"], ["Anthony", "Davis"]],
schema=["FIRST_NAME", "LAST_NAME"],
)

remote_file_path = f"{session.get_session_stage()}/names.parquet"

copy_result = df.write.copy_into_location(
remote_file_path,
file_format_type="parquet",
header=True,
overwrite=True,
single='hoge',
)



from typing import Optional, TypedDict, Literal, overload, Unpack, Union

class Hoge(TypedDict, total=False):
fuga: Literal['hoge', 'fuga']
hogehoge: bool


@overload
def get_hoge(fuga: Literal[True], *, hoge: Optional[str] = '', **kwargs: str) -> None:
...
@overload
def get_hoge(fuga: Literal[False], *, hoge: Optional[str] = None, **kwargs: str) -> bool:
...

def get_hoge(fuga: bool, *, hoge: Optional[str] = '', **kwargs: str) -> Union[None, bool]:
if fuga:
return None
return False

def get_fuga(fuga: bool, *, hogehoge: bool = False, fugafuga: bool = True):
get_hoge(fuga)

get_fuga(fuga=True, fugafuga=False)

0 comments on commit 625519f

Please sign in to comment.