def main(args=None): if args is None: args = sys.argv[1:] try: results, succeeded = handle_and_check(args) if succeeded: exit_code = ExitCodes.Success else: exit_code = ExitCodes.ModelError except KeyboardInterrupt: logger.info("ctrl-c") exit_code = ExitCodes.UnhandledError # This can be thrown by eg. argparse except SystemExit as e: exit_code = e.code except BaseException as e: logger.warn("Encountered an error:") logger.warn(str(e)) if logger_initialized(): logger.debug(traceback.format_exc()) elif not isinstance(e, RuntimeException): # if it did not come from dbt proper and the logger is not # initialized (so there's no safe path to log to), log the stack # trace at error level. logger.error(traceback.format_exc()) exit_code = ExitCodes.UnhandledError _python2_compatibility_message() sys.exit(exit_code)
def log_warnings(self): target_cfg = self.run_environment() db_type = target_cfg.get('type') if db_type == 'snowflake' and self.cfg \ .get('quoting', {}) \ .get('identifier') is None: msg = dbt.ui.printer.yellow( 'You are using Snowflake, but you did not specify a ' 'quoting strategy for your identifiers.\nQuoting ' 'behavior for Snowflake will change in a future release, ' 'so it is recommended that you define this explicitly.\n\n' 'For more information, see: {}\n') logger.warn(msg.format(dbt.links.SnowflakeQuotingDocs))