(
entity_df: Union[pd.DataFrame, str],
snowflake_conn: SnowflakeConnection,
config: RepoConfig,
table_name: str,
)
| 1245 | |
| 1246 | |
| 1247 | def _upload_entity_df( |
| 1248 | entity_df: Union[pd.DataFrame, str], |
| 1249 | snowflake_conn: SnowflakeConnection, |
| 1250 | config: RepoConfig, |
| 1251 | table_name: str, |
| 1252 | ) -> None: |
| 1253 | if isinstance(entity_df, pd.DataFrame): |
| 1254 | # Write the data from the DataFrame to the table |
| 1255 | # Known issues with following entity data types: BINARY |
| 1256 | write_pandas( |
| 1257 | snowflake_conn, |
| 1258 | entity_df, |
| 1259 | table_name, |
| 1260 | auto_create_table=True, |
| 1261 | create_temp_table=True, |
| 1262 | ) |
| 1263 | |
| 1264 | return None |
| 1265 | elif isinstance(entity_df, str): |
| 1266 | # If the entity_df is a string (SQL query), create a Snowflake table out of it, |
| 1267 | query = f'CREATE TEMPORARY TABLE "{table_name}" AS ({entity_df})' |
| 1268 | execute_snowflake_statement(snowflake_conn, query) |
| 1269 | |
| 1270 | return None |
| 1271 | else: |
| 1272 | raise InvalidEntityType(type(entity_df)) |
| 1273 | |
| 1274 | |
| 1275 | def _fix_entity_selections_identifiers(query_context) -> list: |
no test coverage detected