Using a big object for race lap history

Formula 1 is a sport that has been running for many years and, as such, has likely gathered huge amounts of racing data captured from the various timing and telemetry devices around the racing circuits and, these days, within the cars themselves. The competing teams store and analyze that data to build better and faster cars to beat their opponents! In order to explore this on the Lightning Platform, we are going to create the Race Lap History object and import some publicly available historic lap timing data into it.

The sample code included with this chapter includes this object. From the Setup menu, search for Big Objects. The following screenshot shows the Race Lap History object definition:

Notice in the preceding screenshot that the object does not have the usual Id standard field. This represents the first main difference between big objects and Custom Objects. Keys to records in a big object are idempotent, they do not change, meaning that they must always be known before the record is inserted and that the record is always referenced by that known key forevermore. Sometimes, this is known as the "natural key" (because it's typically human-readable, such as an order number). This, in fact, bears some resemblance to the upsert semantics when using an external ID on a Custom Object. The use of natural keys to access records is an implication of the underlying NoSQL access patterns described earlier. Since there is no transaction support, you must be able to easily retry a failed operation without risking adding another record.

The implications of not having a standard Salesforce ID and the performance implications of displaying billions of records in real time does mean that big object record data cannot be accessed via the standard Lightning Experience and Salesforce Mobile user experiences, including Salesforce Reports and Dashboards. These are not designed at present to handle billions of records. However, it is possible to use SOQL and some Database class methods to build your own UIs that allow users to interact with big object data. Later in this chapter, you will see an Async SOQL example that exports a summarized fragment of big object data into a Custom Object that can then be used as normal in the standard UIs.

AppExchange is a great place to find applications and utilities. The Big Object Utility package (https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3A00000EcvSsUAJ) is provided free of charge by a member of the community (not associated with Salesforce or myself) to help visualize the big object data in Lightning Experience. This utility uses the APIs discussed in this section.

For the Race Lap History object, the Race Id, Driver Id, and Lap fields are all used to form a unique index for the lap record data. This object and its fields have been designed to fit the dataset we will be leveraging in this chapter, which comes from a public-facing website known as Ergast (https://ergast.com/mrd/). The following screenshot shows the website's banner:

The author of this website kindly provides Formula 1 racing data dating back from 1950 to the present day in both API form and as downloadable CSV files. In the next section, we are going to download the data and upload one of the files to the Race Lap History object. I want to give a special thanks to Chris, who runs the site, for his support in my using this data!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.51.157