File tree Expand file tree Collapse file tree 2 files changed +29
-3
lines changed Expand file tree Collapse file tree 2 files changed +29
-3
lines changed Original file line number Diff line number Diff line change 45
45
from .log_configuration import EasyLoggingConfigPython
46
46
from .version import VERSION
47
47
48
+ from typing import TypeVar , ParamSpec , Unpack
49
+
50
+ P = ParamSpec ("P" )
51
+ T = TypeVar ("T" , bound = SnowflakeConnection )
52
+
48
53
logging .getLogger (__name__ ).addHandler (NullHandler ())
49
54
setup_external_libraries ()
50
55
51
-
52
56
@wraps (SnowflakeConnection .__init__ )
53
- def Connect (** kwargs ) -> SnowflakeConnection :
54
- return SnowflakeConnection (** kwargs )
57
+ def connect (
58
+ __cls : type [T ] = SnowflakeConnection ,
59
+ / ,
60
+ * args : P .args ,
61
+ ** kwargs : Unpack [P .kwargs ]
62
+ ) -> T :
63
+ return __cls (* args , ** kwargs )
64
+
65
+ # @wraps(SnowflakeConnection.__init__)
66
+ # def Connect(**kwargs) -> SnowflakeConnection:
67
+ # return SnowflakeConnection(**kwargs)
55
68
56
69
57
70
connect = Connect
Original file line number Diff line number Diff line change
1
+ import snowflake .connector as conn
2
+
3
+ c = conn .connect (
4
+ user = "user" ,
5
+ password = "pass" ,
6
+ account = "account"
7
+ )
8
+
9
+ invalid = conn .connect (
10
+ user = "user" ,
11
+ password = 123 ,
12
+ account = "account"
13
+ )
You can’t perform that action at this time.
0 commit comments