I’d like to enable cdata sync’s alter schema feature. However, I want to set any newly discovered columns in the source table to a string data type in the target table.
I’d also like to Alter schema to not change the data type of the target table, even if the source data type changes. My staging tables all use string data types for every field.
Is this possible? is there an advanced setting that I can enable?
I checked the cdata sync documentation for Alter Schema and didn’t see this mentioned.
With AlterSchema property enabled Sync can automatically detect a new column added upstream and add it to the destination table via an ALTER TABLE. It looks like what you are looking for is a way to force the new column type in the source to be a string however, before we can look into suggestions it is important to learn more about the Source and the Destination along with the full use case. Would you be able to provide what is the Source and the Destination?
Regarding the second point, Sync will not attempt to change the datatype. We only alter if the column needs to be widened so if everything is already defined as a string, Sync will not attempt to downcast to an int.
Ethem’s point about widening is useful, but the first requirement is the tricky one: if Sync derives a new target column from the source type, enabling Alter Schema won’t force it to string. If your source supports views, a practical workaround is to sync from a view that CASTs every column to varchar/string; then new columns arrive already as strings and existing target types stay stable. If views aren’t possible, a custom query/transform in Sync may achieve the same—worth confirming with support whether AlterSchema can take a type override.
This website stores cookies on your computer. These cookies are used to collect information about how you interact with our website and allow us to remember you. We use this information in order to improve and customize your browsing experience and for analytics and metrics about our visitors both on this website and other media.
Review section III of our Privacy Policy for more information on cookies.
To opt out of “sale” or “sharing” of non-cookie data, visit our Privacy Rights Request Form.