diff --git a/from snowflake.py b/from snowflake.py new file mode 100644 index 00000000000..ee68854331c --- /dev/null +++ b/from snowflake.py @@ -0,0 +1,55 @@ +from snowflake.snowpark import Session + +connection_parameters: dict[str, int | str] = { + "user": "", + "password": "", + "account": "", + "role": "", + "warehouse": "", + "database": "", + "schema": "", +} + +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) +