File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11reader_config :
22 type_config_name : QueryAPIDataCloudReader
3+ options :
4+ credentials_profile : default
35
46writer_config :
57 type_config_name : PrintDataCloudWriter
8+ options :
9+ credentials_profile : default
610
711spark_config :
812 app_name : DC Custom Code Python SDK Testing
Original file line number Diff line number Diff line change @@ -65,11 +65,11 @@ def from_env(cls) -> Credentials:
6565 ) from exc
6666
6767 @classmethod
68- def from_available (cls ) -> Credentials :
68+ def from_available (cls , profile : str = "default" ) -> Credentials :
6969 if os .environ .get ("SFDC_USERNAME" ):
7070 return cls .from_env ()
7171 if os .path .exists (INI_FILE ):
72- return cls .from_ini ()
72+ return cls .from_ini (profile = profile )
7373 raise ValueError (
7474 "Credentials not found in env or ini file. "
7575 "Run `datacustomcode configure` to create a credentials file."
Original file line number Diff line number Diff line change @@ -75,9 +75,11 @@ class QueryAPIDataCloudReader(BaseDataCloudReader):
7575
7676 CONFIG_NAME = "QueryAPIDataCloudReader"
7777
78- def __init__ (self , spark : SparkSession ) -> None :
78+ def __init__ (
79+ self , spark : SparkSession , credentials_profile : str = "default"
80+ ) -> None :
7981 self .spark = spark
80- credentials = Credentials .from_available ()
82+ credentials = Credentials .from_available (profile = credentials_profile )
8183
8284 self ._conn = SalesforceCDPConnection (
8385 credentials .login_url ,
Original file line number Diff line number Diff line change @@ -26,10 +26,17 @@ class PrintDataCloudWriter(BaseDataCloudWriter):
2626 CONFIG_NAME = "PrintDataCloudWriter"
2727
2828 def __init__ (
29- self , spark : SparkSession , reader : Optional [QueryAPIDataCloudReader ] = None
29+ self ,
30+ spark : SparkSession ,
31+ reader : Optional [QueryAPIDataCloudReader ] = None ,
32+ credentials_profile : str = "default" ,
3033 ) -> None :
3134 super ().__init__ (spark )
32- self .reader = QueryAPIDataCloudReader (self .spark ) if reader is None else reader
35+ self .reader = (
36+ QueryAPIDataCloudReader (self .spark , credentials_profile )
37+ if reader is None
38+ else reader
39+ )
3340
3441 def validate_dataframe_columns_against_dlo (
3542 self ,
You can’t perform that action at this time.
0 commit comments