Skip to main content

FDL in Multiple Files

Larger organizations may find it useful to separate the FDL definition into several files. For example, by project or by application.

The FDL compiler allows you to pass several files on the command line, and parses them in order. That means latter files may use definitions in the earlier files, but not vice versa.

As part of the compilation process, the compiler does a fair amount of sanity checking, including validating:

  1. the FDL can support published audiences and metrics
  2. the FDL is backwards compatible with data in the data warehouse
  3. no feature definitions have naming conflicts

In order to do this, the compiler needs the complete set of FDL definitions. This includes those pertaining to other projects or applications, as long as they are in the same namespace. There are several ways to do this.


Git submodules are designed to solve this problem. The idea is that you'd have everyone commit their FDL files to a shared submodule. Projects that need to use the Causal compiler would include this submodule in their own repository, making the current version of the complete FDL definition available to the compiler.

The approach also has the benefit that changes to the warehouse schema can be reviewed as pull requests to the FDL repository. If you have a data group that would like to review changes to the data being collected from your applications, they could handle these pull requests.

Partial Compilation

If you do not want to use submodules, Causal can also coordinate FDL files through the cloud. The --partial flag to the compiler will combine the files that you pass on the command line with the rest of the files that Causal knows about.

So, say for example you have pushed the FDL files Session.fdl and ProjectA.fdl to the server at some point:

causalc --token XXXX --environment XXX --push-fdl Session.fdl ProjectA.fdl

The following command will compile both files, using the version of Session.fdl that was pushed in the last command.

causalc --token XXXX --environment XXX --partial ProjectA.fdl

If you add a new file on the command line, it is appended onto the end of the list. So the following will compile Session.fdl, ProjectA.fdl, and ProjectB.fdl in that order;

causalc --token XXXX --environment XXX --partial ProjectB.fdl

The partial option can be combined with the --push-fdl option to do the whole thing server side. So, the following command will update the version of FDL for the environment by adding ProjectB.fdl, leaving the other two files in place.

causalc --token XXXX --environment XXX --push-fdl --partial ProjectB.fdl

If you'd like to change the order of the files on the server, you must push the complete list again without the --partial option. So, the following will update the order of the files for subsequent compiles to be Session.fdl, ProjectB.fdl, and finally ProjectA.fdl.

causalc --token XXXX --environment XXX --push-fdl Session.fdl ProjectB.fdl ProjectA.fdl

Local File Cache

If you'd like to see the versions of the FDL files that are currently checked into the server, they are downloaded along with other information that the Causal compiler uses. You can find the complete set in the .causal/fdl directory. The .causal directory can be found in the same directory as the first FDL file that you passed to the compiler.