Пример #1
0
 def dbt_config(self):
     """Loads the dbt config."""
     if self.dbt_version_tuple >= (1, 0):
         # Here, we read flags.PROFILE_DIR directly, prior to calling
         # set_from_args(). Apparently, set_from_args() sets PROFILES_DIR
         # to a lowercase version of the value, and the profile wouldn't be
         # found if the directory name contained uppercase letters. This fix
         # was suggested and described here:
         # https://github.com/sqlfluff/sqlfluff/issues/2253#issuecomment-1018722979
         user_config = read_user_config(flags.PROFILES_DIR)
         flags.set_from_args(
             DbtConfigArgs(
                 project_dir=self.project_dir,
                 profiles_dir=self.profiles_dir,
                 profile=self._get_profile(),
                 vars=self._get_cli_vars(),
             ),
             user_config,
         )
     self.dbt_config = DbtRuntimeConfig.from_args(
         DbtConfigArgs(
             project_dir=self.project_dir,
             profiles_dir=self.profiles_dir,
             profile=self._get_profile(),
             target=self._get_target(),
             vars=self._get_cli_vars(),
         )
     )
     register_adapter(self.dbt_config)
     return self.dbt_config
Пример #2
0
    def dbt_config(self):
        """Loads the dbt config."""
        from dbt.config.runtime import RuntimeConfig as DbtRuntimeConfig
        from dbt.adapters.factory import register_adapter

        self.dbt_config = DbtRuntimeConfig.from_args(
            DbtConfigArgs(
                project_dir=self._get_project_dir(),
                profiles_dir=self._get_profiles_dir(),
                profile=self._get_profile(),
            ))
        register_adapter(self.dbt_config)
        return self.dbt_config