Canonical - Special chars in the file header file

#1

Hello,

I am a newbie here, and my question is related to Canonicals.

It was said that a Canonical is dependent on the header record of a source file, and one of the source file could be a csv.
Eg: a source csv has fields aaa, bbb, ccc
so the corresponding canonical would be -

type CanonicalExample mixes Canonical<CanonicalExample > {
  aaa:  datetime
  bbb:  string
  ccc:   int
}

Now my question is that, a csv does accept values such as “aaa(b)”, “b(123)cd” etc
If, my client shared a source file with such inputs, and I would need to write the canonical basis that, would it be valid?
Following the constraints of canonical, would this be valid?

type CanonicalExample mixes Canonical<CanonicalExample > {
  aaa(a):  datetime
  b(123)bb:  string
  ccc:   int
}

As in many of the programming languages, aaa(a) is a function with parameter a, and is not a valid variable name. How can this be handled?
Does C3 also follow any naming conventions?

Thank you

0 Likes

#2

The csv header fields if provided should match the field names of the Source/Canonical type that you have defined. If you don’t provide the csv header in the file, it will derive the fields from the type declaration itself.
I don’t think we support “(” in field names for types. You can provision the package with the above types to see the error.

0 Likes