@@ -17,10 +17,12 @@ class DataSourceType(Enum):
1717 Attributes:
1818 HUGGINGFACE: HuggingFace dataset source
1919 DISK_FILE: Local file system source
20+ SERVICENOW: ServiceNow table source
2021 """
2122
2223 HUGGINGFACE = "hf"
2324 DISK_FILE = "disk"
25+ SERVICENOW = "servicenow"
2426
2527
2628class TransformConfig (BaseModel ):
@@ -44,13 +46,15 @@ class OutputType(Enum):
4446 JSONL: JSON Lines file output
4547 CSV: CSV file output
4648 PARQUET: Parquet file output
49+ SERVICENOW: ServiceNow table output
4750 """
4851
4952 HUGGINGFACE = "hf"
5053 JSON = "json"
5154 JSONL = "jsonl"
5255 CSV = "csv"
5356 PARQUET = "parquet"
57+ SERVICENOW = "servicenow"
5458 NONE = None
5559
5660
@@ -69,8 +73,14 @@ class ShardConfig(BaseModel):
6973class DataSourceConfig (BaseModel ):
7074 """Configuration for data sources.
7175
72- This class provides configuration options for both HuggingFace datasets
73- and local file system sources, including transformation specifications.
76+ This class provides configuration options for HuggingFace datasets,
77+ local file system sources, and ServiceNow tables, including transformation specs.
78+
79+ For ServiceNow sources:
80+ - Connection credentials (instance, username, password) are read from
81+ environment variables: SNOW_INSTANCE, SNOW_USERNAME, SNOW_PASSWORD
82+ - Only query details (table, filters, fields, etc.) need to be specified
83+ - Config values for credentials are optional overrides
7484
7585 Attributes:
7686 type (DataSourceType): Type of data source
@@ -83,6 +93,9 @@ class DataSourceConfig(BaseModel):
8393 file_format (Optional[str]): Format for local files
8494 file_path (Optional[str]): Path to local file
8595 encoding (str): Character encoding for text files
96+ table (Optional[str]): ServiceNow table name for queries
97+ filters (Optional[dict]): Filters for ServiceNow queries
98+ fields (Optional[list[str]]): Fields to retrieve from ServiceNow
8699 transformations (Optional[list[TransformConfig]]): List of transformations to apply
87100 """
88101
@@ -101,6 +114,27 @@ class DataSourceConfig(BaseModel):
101114 file_path : Optional [str ] = None
102115 encoding : str = "utf-8"
103116
117+ # For ServiceNow tables
118+ instance : Optional [str ] = None
119+ username : Optional [str ] = None
120+ password : Optional [str ] = None
121+ oauth_client_id : Optional [str ] = None
122+ oauth_client_secret : Optional [str ] = None
123+ table : Optional [str ] = None
124+ query : Optional [str ] = None
125+ filters : Optional [dict [str , Any ]] = None
126+ fields : Optional [list [str ]] = None
127+ limit : Optional [int ] = None
128+ batch_size : int = 100
129+ order_by : Optional [str ] = None
130+ order_desc : bool = False
131+ display_value : str = "all"
132+ exclude_reference_link : bool = True
133+ proxy : Optional [str ] = None
134+ verify_ssl : Optional [bool ] = None
135+ cert : Optional [str ] = None
136+ auto_retry : bool = True
137+
104138 # Transformation functions
105139 transformations : Optional [list [TransformConfig ]] = None
106140
@@ -169,8 +203,14 @@ def from_dict(cls, config: dict[str, Any]) -> "DataSourceConfig":
169203class OutputConfig (BaseModel ):
170204 """Configuration for data output operations.
171205
172- This class provides configuration options for both HuggingFace datasets
173- and local file system outputs.
206+ This class provides configuration options for HuggingFace datasets,
207+ local file system outputs, and ServiceNow tables.
208+
209+ For ServiceNow outputs:
210+ - Connection credentials (instance, username, password) are read from
211+ environment variables: SNOW_INSTANCE, SNOW_USERNAME, SNOW_PASSWORD
212+ - Only operation details (table, operation, key_field) need to be specified
213+ - Config values for credentials are optional overrides
174214
175215 Attributes:
176216 type (OutputType): Type of output
@@ -183,6 +223,9 @@ class OutputConfig(BaseModel):
183223 filename (Optional[str]): Output filename
184224 file_path (Optional[str]): Output file path
185225 encoding (str): Character encoding for text files
226+ table (Optional[str]): ServiceNow table name for output
227+ operation (str): ServiceNow operation (insert/update/upsert)
228+ key_field (str): Field to match for update/upsert operations
186229 """
187230
188231 type : Optional [OutputType ] = None
@@ -196,6 +239,20 @@ class OutputConfig(BaseModel):
196239 file_path : Optional [str ] = None
197240 encoding : str = "utf-8"
198241
242+ # For ServiceNow output
243+ instance : Optional [str ] = None
244+ username : Optional [str ] = None
245+ password : Optional [str ] = None
246+ oauth_client_id : Optional [str ] = None
247+ oauth_client_secret : Optional [str ] = None
248+ table : Optional [str ] = None
249+ operation : str = "insert" # insert, update, or upsert
250+ key_field : str = "sys_id" # Field to match for update/upsert
251+ proxy : Optional [str ] = None
252+ verify_ssl : Optional [bool ] = None
253+ cert : Optional [str ] = None
254+ auto_retry : bool = True
255+
199256 @classmethod
200257 def from_dict (cls , config : dict [str , Any ]) -> "OutputConfig" :
201258 """Create configuration from dictionary.
@@ -217,4 +274,17 @@ def from_dict(cls, config: dict[str, Any]) -> "OutputConfig":
217274 filename = config .get ("filename" ),
218275 file_path = config .get ("file_path" ),
219276 encoding = config .get ("encoding" , "utf-8" ),
277+ # ServiceNow fields
278+ instance = config .get ("instance" ),
279+ username = config .get ("username" ),
280+ password = config .get ("password" ),
281+ oauth_client_id = config .get ("oauth_client_id" ),
282+ oauth_client_secret = config .get ("oauth_client_secret" ),
283+ table = config .get ("table" ),
284+ operation = config .get ("operation" , "insert" ),
285+ key_field = config .get ("key_field" , "sys_id" ),
286+ proxy = config .get ("proxy" ),
287+ verify_ssl = config .get ("verify_ssl" ),
288+ cert = config .get ("cert" ),
289+ auto_retry = config .get ("auto_retry" , True ),
220290 )
0 commit comments