Package: dbml-to-fides
dbml-to-fidesThis tool convertsDBMLtoFides dataset manifests.It optionally has support for merging the result from DBML into an existing
Fides dataset manifest.Combined, this can be used in automation to ensure that datasets are kept
up-to-date with the latest schema changes in continuous integration.UsageBasicGiven a sample DBML insample.dbml:Table users {
  id integer [primary key]
  username varchar
  role varchar
  created_at timestamp
}

Table posts {
  id integer [primary key]
  title varchar
  body text [note: 'Content of the post']
  user_id integer
  status post_status
  created_at timestamp
}

Enum post_status {
  draft
  published
  private [note: 'visible via URL only']
}

Ref: posts.user_id > users.id // many-to-onedbml-to-fideswill output what it can infer from the DBML file as a Fides
dataset:$dbml-to-fidessample.dbml
dataset:
-name:publiccollections:-name:usersdescription:Usersfields:-name:idfides_meta:primary_key:true-name:username-name:role-name:created_at-name:postsdescription:Allthecontentyoucravefields:-name:idfides_meta:primary_key:true-name:title-name:bodydescription:Contentofthepost-name:user_idfides_meta:references:-dataset:publicfield:users.iddirection:to-name:status-name:created_atMerging with existing Fides datasetIf you have an existing Fides dataset in.fides/sample_dataset.yml:dataset:-fides_key:sample_datasetorganization_fides_key:default_organizationname:publicdescription:Sample dataset for my systemmeta:nulldata_categories:[]data_qualifier:aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identifiedretention:30 days after account deletioncollections:-name:usersdescription:User informationfields:-name:idfides_meta:primary_key:truedescription:User's unique IDdata_categories:-user.unique_iddata_qualifier:aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified-name:usernamedescription:User's usernamedata_categories:-user.namedata_qualifier:aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identifiedretention:Account termination-name:roledescription:User's system level role/privilegedata_categories:-system.operationsdata_qualifier:aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified-name:created_atdescription:User's creation timestampdata_categories:-system.operationsdata_qualifier:aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified-name:postsdescription:Post informationfields:-name:idfides_meta:primary_key:truedescription:Post's unique IDdata_categories:-system.operationsdata_qualifier:aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified-name:titledescription:Post's titledata_categories:-system.operationsdata_qualifier:aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified-name:bodydescription:Post's bodydata_categories:-system.operationsdata_qualifier:aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified-name:user_idfides_meta:references:-dataset:publicfield:users.iddirection:todescription:Post creator's unique User IDdata_categories:-user.unique_iddata_qualifier:aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified-name:statusdescription:User's creation timestampdata_categories:-system.operationsdata_qualifier:aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified-name:created_atdescription:Post's creation timestampdata_categories:-system.operationsdata_qualifier:aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identifieddbml-to-fidescan be used with the--base-datasetoption to merge the results together.
But, in this case there are no differences:$diff-u.fides/sample_dataset.yml<(dbml-to-fidessample.dbml--base-dataset.fides/sample_dataset.yml)$If we introduce a change to the DBML:@@ -3,6 +3,7 @@ Table users {username varcharrole varcharcreated_at timestamp+  social_security_number varchar}Table posts {Then running our diff again will add the field to our Fides dataset:$diff-u.fides/sample_dataset.yml<(dbml-to-fidessample.dbml--base-dataset.fides/sample_dataset.yml)---.fides/sample_dataset.yml2023-05-2215:39:24
+++/dev/fd/632023-05-2215:40:07
@@-34,6+34,7@@data_categories:-system.operationsdata_qualifier:aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
+-name:social_security_number-name:postsdescription:Postinformationfields:File outputIf we wanted to write the output to a file,
we would add the--output-fileflag:$dbml-to-fidessample.dbml--base-dataset.fides/sample_dataset.yml--output-file.fides/sample_dataset.yml
$gitdiff
diff--gita/.fides/sample_dataset.ymlb/.fides/sample_dataset.yml
index594cee4..edc3141100644---a/.fides/sample_dataset.yml
+++b/.fides/sample_dataset.yml
@@-34,6+34,7@@dataset:data_categories:-system.operationsdata_qualifier:aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
+-name:social_security_number-name:postsdescription:Postinformationfields:Initial generationIf you do not have an existing Fides dataset, the--include-fides-keysflag will
create a more "fleshed out" version of aFides datasetincluding all keys. See thedocsfor what each field can/should be populated with.$dbml-to-fidessample.dbml--include-fides-keys
dataset:
-fides_key:nullname:publicdescription:nullorganization_fides_key:nullmeta:{}third_country_transfers:[]joint_controller:[]retention:nulldata_categories:[]data_qualifiers:[]collections:-name:usersdescription:Usersdata_categories:[]data_qualifiers:[]retention:nullfields:-name:iddescription:nulldata_categories:[]data_qualifier:nullretention:nullfides_meta:primary_key:true-name:usernamedescription:nulldata_categories:[]data_qualifier:nullretention:null-name:roledescription:nulldata_categories:[]data_qualifier:nullretention:null-name:created_atdescription:nulldata_categories:[]data_qualifier:nullretention:null-name:socialdescription:nulldata_categories:[]data_qualifier:nullretention:null-name:postsdescription:Allthecontentyoucravedata_categories:[]data_qualifiers:[]retention:nullfields:-name:iddescription:nulldata_categories:[]data_qualifier:nullretention:nullfides_meta:primary_key:true-name:titledescription:nulldata_categories:[]data_qualifier:nullretention:null-name:bodydescription:Contentofthepostdata_categories:[]data_qualifier:nullretention:null-name:user_iddescription:nulldata_categories:[]data_qualifier:nullretention:nullfides_meta:references:-dataset:publicfield:users.iddirection:to-name:statusdescription:nulldata_categories:[]data_qualifier:nullretention:null-name:created_atdescription:nulldata_categories:[]data_qualifier:nullretention:null