14
14
15
15
from __future__ import annotations
16
16
17
- from pathlib import Path
18
17
from typing import Optional
19
18
20
19
import yaml
21
20
from click import ClickException
22
21
from snowflake .cli ._plugins .stage .manager import StageManager
23
22
from snowflake .cli .api .console import cli_console
23
+ from snowflake .cli .api .constants import DEFAULT_SIZE_LIMIT_MB
24
24
from snowflake .cli .api .identifiers import FQN
25
+ from snowflake .cli .api .secure_path import SecurePath
25
26
from snowflake .cli .api .sql_execution import SqlExecutionMixin
26
27
from snowflake .connector .cursor import SnowflakeCursor
27
28
@@ -33,19 +34,19 @@ def list(self) -> SnowflakeCursor: # noqa: A003
33
34
34
35
def deploy (
35
36
self ,
36
- path : Path ,
37
+ path : SecurePath ,
37
38
name : FQN ,
38
39
dbt_version : Optional [str ],
39
40
dbt_adapter_version : str ,
40
41
execute_in_warehouse : Optional [str ],
41
42
force : bool ,
42
43
) -> SnowflakeCursor :
43
- dbt_project_path = path . joinpath ( "dbt_project.yml" )
44
+ dbt_project_path = path / "dbt_project.yml"
44
45
if not dbt_project_path .exists ():
45
46
raise ClickException (f"dbt_project.yml does not exist in provided path." )
46
47
47
48
if dbt_version is None :
48
- with dbt_project_path .open () as fd :
49
+ with dbt_project_path .open (read_file_limit_mb = DEFAULT_SIZE_LIMIT_MB ) as fd :
49
50
dbt_project_config = yaml .safe_load (fd )
50
51
try :
51
52
dbt_version = dbt_project_config ["version" ]
@@ -61,7 +62,7 @@ def deploy(
61
62
stage_manager .create (stage_fqn , temporary = True )
62
63
63
64
with cli_console .phase ("Copying project files to stage" ):
64
- results = list (stage_manager .put_recursive (path , stage_name ))
65
+ results = list (stage_manager .put_recursive (path . path , stage_name ))
65
66
cli_console .step (f"Copied { len (results )} files" )
66
67
67
68
with cli_console .phase ("Creating DBT project" ):
0 commit comments