@@ -52,12 +52,12 @@ def main():
5252 if not base_url :
5353 print ("No URL entered; exiting." )
5454 sys .exit (1 )
55-
56- base_url = base_url .rstrip ('/' )
57-
55+
56+ base_url = base_url .rstrip ("/" )
57+
5858 log_call ("InteractiveBrowserCredential()" )
5959 credential = InteractiveBrowserCredential ()
60-
60+
6161 log_call (f"DataverseClient(base_url='{ base_url } ', credential=...)" )
6262 client = DataverseClient (base_url = base_url , credential = credential )
6363 print (f"✓ Connected to: { base_url } " )
@@ -70,10 +70,10 @@ def main():
7070 print ("=" * 80 )
7171
7272 table_name = "new_WalkthroughDemo"
73-
73+
7474 log_call (f"client.get_table_info('{ table_name } ')" )
7575 table_info = client .get_table_info (table_name )
76-
76+
7777 if table_info :
7878 print (f"✓ Table already exists: { table_info .get ('table_schema_name' )} " )
7979 print (f" Logical Name: { table_info .get ('table_logical_name' )} " )
@@ -85,7 +85,7 @@ def main():
8585 "new_Quantity" : "int" ,
8686 "new_Amount" : "decimal" ,
8787 "new_Completed" : "bool" ,
88- "new_Priority" : Priority
88+ "new_Priority" : Priority ,
8989 }
9090 table_info = client .create_table (table_name , columns )
9191 print (f"✓ Created table: { table_info .get ('table_schema_name' )} " )
@@ -105,7 +105,7 @@ def main():
105105 "new_Quantity" : 5 ,
106106 "new_Amount" : 1250.50 ,
107107 "new_Completed" : False ,
108- "new_Priority" : Priority .MEDIUM
108+ "new_Priority" : Priority .MEDIUM ,
109109 }
110110 id1 = client .create (table_name , single_record )[0 ]
111111 print (f"✓ Created single record: { id1 } " )
@@ -118,22 +118,22 @@ def main():
118118 "new_Quantity" : 10 ,
119119 "new_Amount" : 500.00 ,
120120 "new_Completed" : True ,
121- "new_Priority" : Priority .HIGH
121+ "new_Priority" : Priority .HIGH ,
122122 },
123123 {
124124 "new_Title" : "Update test cases" ,
125125 "new_Quantity" : 8 ,
126126 "new_Amount" : 750.25 ,
127127 "new_Completed" : False ,
128- "new_Priority" : Priority .LOW
128+ "new_Priority" : Priority .LOW ,
129129 },
130130 {
131131 "new_Title" : "Deploy to staging" ,
132132 "new_Quantity" : 3 ,
133133 "new_Amount" : 2000.00 ,
134134 "new_Completed" : False ,
135- "new_Priority" : Priority .HIGH
136- }
135+ "new_Priority" : Priority .HIGH ,
136+ },
137137 ]
138138 ids = client .create (table_name , multiple_records )
139139 print (f"✓ Created { len (ids )} records: { ids } " )
@@ -149,15 +149,20 @@ def main():
149149 log_call (f"client.get('{ table_name } ', '{ id1 } ')" )
150150 record = client .get (table_name , id1 )
151151 print ("✓ Retrieved single record:" )
152- print (json .dumps ({
153- "new_walkthroughdemoid" : record .get ("new_walkthroughdemoid" ),
154- "new_title" : record .get ("new_title" ),
155- "new_quantity" : record .get ("new_quantity" ),
156- "new_amount" : record .get ("new_amount" ),
157- "new_completed" : record .get ("new_completed" ),
158- "new_priority" : record .get ("new_priority" ),
159- "new_priority@FormattedValue" : record .get ("new_priority@OData.Community.Display.V1.FormattedValue" )
160- }, indent = 2 ))
152+ print (
153+ json .dumps (
154+ {
155+ "new_walkthroughdemoid" : record .get ("new_walkthroughdemoid" ),
156+ "new_title" : record .get ("new_title" ),
157+ "new_quantity" : record .get ("new_quantity" ),
158+ "new_amount" : record .get ("new_amount" ),
159+ "new_completed" : record .get ("new_completed" ),
160+ "new_priority" : record .get ("new_priority" ),
161+ "new_priority@FormattedValue" : record .get ("new_priority@OData.Community.Display.V1.FormattedValue" ),
162+ },
163+ indent = 2 ,
164+ )
165+ )
161166
162167 # Multiple read with filter
163168 log_call (f"client.get('{ table_name } ', filter='new_quantity gt 5')" )
@@ -201,7 +206,7 @@ def main():
201206 "new_Quantity" : i ,
202207 "new_Amount" : i * 10.0 ,
203208 "new_Completed" : False ,
204- "new_Priority" : Priority .LOW
209+ "new_Priority" : Priority .LOW ,
205210 }
206211 for i in range (1 , 21 )
207212 ]
@@ -212,7 +217,7 @@ def main():
212217 log_call (f"client.get('{ table_name } ', page_size=5)" )
213218 print ("Fetching records with page_size=5..." )
214219 for page_num , page in enumerate (client .get (table_name , orderby = ["new_Quantity" ], page_size = 5 ), start = 1 ):
215- record_ids = [r .get (' new_walkthroughdemoid' )[:8 ] + "..." for r in page ]
220+ record_ids = [r .get (" new_walkthroughdemoid" )[:8 ] + "..." for r in page ]
216221 print (f" Page { page_num } : { len (page )} records - IDs: { record_ids } " )
217222
218223 # ============================================================================
@@ -245,7 +250,7 @@ def main():
245250 "new_Quantity" : 1 ,
246251 "new_Amount" : 99.99 ,
247252 "new_Completed" : False ,
248- "new_Priority" : "High" # String label instead of int
253+ "new_Priority" : "High" , # String label instead of int
249254 }
250255 label_id = client .create (table_name , label_record )[0 ]
251256 retrieved = client .get (table_name , label_id )
0 commit comments