The incoming data may contain a numeric field for an ID Field but it is likely a string field. Or a field has both normal string as well as HTML string and it needs to be treated as HTML. Or a number field actually represents a year. SQL Frames provides the ability to convert the data types of fields. These conversions happen in-place replacing the original values.
It is possible to add type conversions that get invoked while computing the DataFrame by
using the following API available in
Below are the list of type converters.
|converts any value to a string
|converts a string or integer value to a Number type
|converts string or numeric values to Number type with 0 decimals
|converts a string to a Date type without time component
|converts a string to a Date type with date and time components
|converts a date or number value to a Year type
|converts a date to a Month type
|converts a date to a Quarter type
|converts a string value to a URL type
|converts a string to a HTML type
|converts a string into an Array
SQL Frames uses the date-fns library. Refer to date-fns
parse API docs for the
related to the
Converting to HTML
Some data such as product feeds can contain HTML in some fields. They are by default recognized as string fields resulting in displaying the markup in the DataFrame tables rather than showing them as HTML. It is possible to convert them to HTML data type and get displayed as HTML.
HTML fields are sanitized using DOMPurify to prevent XSS attacks.