Discover a table from the external database
Typically, you would have discovered the table from the remote database, with a code similar to:Manually create a table
It is possible to manually provide all the information about the external table so no discovery is done. This is achieved by providing the external table to use, describing all the fields of the table and defining the key fields:Customize a table
Each table can be customized. Note that all the changes are done in the local data structure, and nothing is written in the external database.Rename the table
For instance, you can rename the table:Select a subset of fields
The remote table might also contain some fields which are not relevant for the application. It’s possible to select the fields you want:Set the keys
It is also possible to set the key(s) when it is not set properly.Set the clustering fields
Clustering fields can also be set.Customize a field
Each field in a table can be customized as well. As a general note, do not forget to update the field in the table.Rename the field
The field can be renamed:Change the type
The type can also be updated:Make field non nullable
You can mark explicitly the field as non-nullable in your application:Use a custom type
This is a bit more complex, and can be found in the dedicated guide.Naming convention
Instead of renaming the fields one by one it is possible to apply a naming convention to rename the table and the fields. Some usual naming conventions can be found in theNamingConventions utility class.
For instance, it can be used to switch everything to lower case, upper case or capitalized:
INamingConvention using NamingConventions.from.
Create a table from a SQL expression
It is possible to create a table based on a SQL expression. The expression must comply to the dialect of the used external database.Here an example of a static table expression in Clickhouse dialect:
Such tables do not support time-travel (native or emulated).