Ensuring Naming Conventions/Types?

Do folks have any strategies to enforce naming/typing conventions in your models? For example:

  • Every BOOLEAN column should start with is_ or has_
  • If a column starts with is_ or has_, it should be BOOLEAN

Some solutions that come to mind:

  • :package: An existing DBT package … that’d be ideal, but I haven’t found anything
  • :memo: Catch this in a code review … that’d be nice, but this is something a human could easily miss!
  • :gear: Have some sort of check on your yaml files … that assumes that folks are documenting their models properly
  • :robot: Run these checks against the database after dbt run … this seems like the most robust option, but it feels like a lot of work

There was a talk at Coalesce last year about something similar: Operationalizing Column-Name Contracts with dbtplyr

They had a dbt package called dbtplyr and if I remember right one of their examples was your BOOLEAN use case.

Thanks! I looked through the slides and I think I can leverage dbtplyr.

I took a lot of inspiration from column names as contracts, so this talk is a great supplement.