Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
result.node.get('original_file_path')))
logger.info(" Got {} results, expected 0.".format(result.status))
if result.node.get('build_path') is not None:
logger.info("")
logger.info(" compiled SQL at {}".format(
result.node.get('build_path')))
else:
first = True
for line in result.error.split("\n"):
if first:
logger.info(yellow(line))
first = False
else:
logger.info(line)
display_host = host
if host == '0.0.0.0':
display_host = 'localhost'
logger.info(
'Serving RPC server at {}:{}, pid={}'.format(
*addr, os.getpid()
)
)
logger.info(
'Supported methods: {}'.format(sorted(self.task_manager.methods()))
)
logger.info(
'Send requests to http://{}:{}/jsonrpc'.format(display_host, port)
)
app = DispatcherMiddleware(self.handle_request, {
'/jsonrpc': self.handle_jsonrpc_request,
})
# we have to run in threaded mode if we want to share subprocess
# handles, which is the easiest way to implement `kill` (it makes
# `ps` easier as well). The alternative involves tracking
# metadata+state in a multiprocessing.Manager, adds polling the
# manager to the request task handler and in general gets messy
# fast.
run_simple(
host,
port,
def get_nodes_from_spec(self, graph, spec):
try:
collected = self.select_included(graph.nodes(),
spec.selector_type,
spec.selector_value)
except InvalidSelectorError:
valid_selectors = ", ".join(s.FILTER for s in self.SELECTORS)
logger.info("The '{}' selector specified in {} is invalid. Must "
"be one of [{}]".format(
spec.selector_type,
spec.raw,
valid_selectors))
return set()
specified = graph.collect_models(collected, spec)
collected.update(specified)
tests = {
n for n in graph.select_successors(collected)
if self.manifest.nodes[n].resource_type == NodeType.Test
}
collected.update(tests)
return collected
def parse_schema_tests(tests, root_project, projects, macros=None):
to_return = {}
for test in tests:
raw_yml = test.get('raw_yml')
test_name = "{}:{}".format(test.get('package_name'), test.get('path'))
try:
test_yml = dbt.clients.yaml_helper.load_yaml_text(raw_yml)
except dbt.exceptions.ValidationException as e:
test_yml = None
logger.info("Error reading {} - Skipping\n{}".format(test_name, e))
if test_yml is None:
continue
no_tests_warning = ("* WARNING: No constraints found for model"
" '{}' in file {}\n")
for model_name, test_spec in test_yml.items():
if test_spec is None or test_spec.get('constraints') is None:
test_path = test.get('original_file_path', '')
logger.warning(no_tests_warning.format(model_name, test_path))
continue
for test_type, configs in test_spec.get('constraints', {}).items():
if configs is None:
continue
def write_relation(self, design_file_path, yml):
if os.path.isfile(design_file_path):
logger.info(
dbt.ui.printer.yellow(
"Warning: File {} already exists. Skipping".format(design_file_path)
)
)
return
logger.info("Creating design file: {}".format(design_file_path))
with open(design_file_path, "w") as f:
f.write(yml)
def path_info(self):
open_cmd = dbt.clients.system.open_dir_cmd()
message = PROFILE_DIR_MESSAGE.format(
open_cmd=open_cmd,
profiles_dir=self.profiles_dir
)
logger.info(message)
def safe_run_hooks(self, adapter, hook_type: RunHookType, extra_context):
try:
self.run_hooks(adapter, hook_type, extra_context)
except dbt.exceptions.RuntimeException:
logger.info("Database error while running {}".format(hook_type))
raise