|
137 | 137 | }
|
138 | 138 |
|
139 | 139 |
|
140 |
| -def as_uri(path: str | Path) -> str: |
141 |
| - """Convert a path to a file URI.""" |
142 |
| - return Path(path).absolute().as_uri() |
143 |
| - |
144 |
| - |
145 | 140 | class Backend(SQLBackend, CanCreateCatalog, CanCreateDatabase):
|
146 | 141 | name = "snowflake"
|
147 | 142 | compiler = sc.snowflake.compiler
|
@@ -926,10 +921,12 @@ def read_csv(
|
926 | 921 | urlretrieve(path, filename=tmpname) # noqa: S310
|
927 | 922 | tmp.flush()
|
928 | 923 | cur.execute(
|
929 |
| - f"PUT '{as_uri(tmpname)}' @{stage} PARALLEL = {threads:d}" |
| 924 | + f"PUT 'file://{Path(tmpname).absolute().as_posix()}' @{stage} PARALLEL = {threads:d}" |
930 | 925 | )
|
931 | 926 | else:
|
932 |
| - cur.execute(f"PUT '{as_uri(path)}' @{stage} PARALLEL = {threads:d}") |
| 927 | + cur.execute( |
| 928 | + f"PUT 'file://{Path(path).absolute().as_posix()}' @{stage} PARALLEL = {threads:d}" |
| 929 | + ) |
933 | 930 |
|
934 | 931 | # handle setting up the schema in python because snowflake is
|
935 | 932 | # broken for csv globs: it cannot parse the result of the following
|
@@ -1055,7 +1052,7 @@ def read_json(
|
1055 | 1052 | )
|
1056 | 1053 | with self._safe_raw_sql(";\n".join(stmts)) as cur:
|
1057 | 1054 | cur.execute(
|
1058 |
| - f"PUT 'file://{Path(path).absolute()}' @{stage} PARALLEL = {threads:d}" |
| 1055 | + f"PUT 'file://{Path(path).absolute().as_posix()}' @{stage} PARALLEL = {threads:d}" |
1059 | 1056 | )
|
1060 | 1057 | cur.execute(
|
1061 | 1058 | ";\n".join(
|
@@ -1104,7 +1101,7 @@ def read_parquet(
|
1104 | 1101 |
|
1105 | 1102 | from ibis.formats.pyarrow import PyArrowSchema
|
1106 | 1103 |
|
1107 |
| - abspath = Path(path).absolute() |
| 1104 | + abspath = Path(path).absolute().as_posix() |
1108 | 1105 | schema = PyArrowSchema.to_ibis(
|
1109 | 1106 | ds.dataset(glob.glob(str(abspath)), format="parquet").schema
|
1110 | 1107 | )
|
|
0 commit comments