Get a Table Instance
A table reference can be created by referring to the pre-defined data store reference by passing either the tableID or table name as the parameter. The datastore_service reference used in the below code snippet is the component instance created earlier.
Get the Table Instance using TableID
The table_service reference can be created by passing the tableID as a parameter to the table() method.
copy
#Get table instance using table ID
datastore_service = app.datastore()
table_service = datastore_service.table(5249000000011745)
Get the Table Instance using Table Name
Alternatively, a table reference can be created by referring the tablename in the table() method. There is no explicit response involved in these methods and the instance of the table alone is returned.
copy
#Get table instance using table name
datastore_service = app.datastore()
table_service = datastore_service.table("CITY")
Yes
No
Send your feedback to us
Skip
Submit