|
13 | 13 |
|
14 | 14 | from target_snowflake.snowflake_types import NUMBER, TIMESTAMP_NTZ, VARIANT |
15 | 15 |
|
16 | | - |
17 | 16 | SNOWFLAKE_MAX_STRING_LENGTH = 16777216 |
18 | 17 |
|
19 | 18 | class TypeMap: |
@@ -270,7 +269,7 @@ def schema_exists(self, schema_name: str) -> bool: |
270 | 269 |
|
271 | 270 | def _get_put_statement(self, sync_id: str, file_uri: str) -> Tuple[text, dict]: |
272 | 271 | """Get Snowflake PUT statement.""" |
273 | | - return (text(f"put '{file_uri}' '@~/target-snowflake/{sync_id}'"), {}) |
| 272 | + return (text(f"put :file_uri '@~/target-snowflake/{sync_id}'"), {}) |
274 | 273 |
|
275 | 274 | def _get_column_selections(self, schema: dict, formatter: SnowflakeIdentifierPreparer) -> list: |
276 | 275 | column_selections = [] |
@@ -372,7 +371,9 @@ def put_batches_to_stage(self, sync_id: str, files: Sequence[str]) -> None: |
372 | 371 | put_statement, kwargs = self._get_put_statement( |
373 | 372 | sync_id=sync_id, file_uri=file_uri |
374 | 373 | ) |
375 | | - conn.execute(put_statement, **kwargs) |
| 374 | + # sqlalchemy.text stripped a slash, which caused windows to fail so we used bound parameters instead |
| 375 | + # See https://github.com/MeltanoLabs/target-snowflake/issues/87 for more information about this error |
| 376 | + conn.execute(put_statement, file_uri=file_uri, **kwargs) |
376 | 377 |
|
377 | 378 | def create_file_format(self, file_format: str) -> None: |
378 | 379 | """Create a file format in the schema. |
|
0 commit comments