partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | Drive.get_special_folder | Returns the specified Special Folder
:return: a special Folder
:rtype: drive.Folder | O365/drive.py | def get_special_folder(self, name):
""" Returns the specified Special Folder
:return: a special Folder
:rtype: drive.Folder
"""
name = name if \
isinstance(name, OneDriveWellKnowFolderNames) \
else OneDriveWellKnowFolderNames(name.lower())
name =... | def get_special_folder(self, name):
""" Returns the specified Special Folder
:return: a special Folder
:rtype: drive.Folder
"""
name = name if \
isinstance(name, OneDriveWellKnowFolderNames) \
else OneDriveWellKnowFolderNames(name.lower())
name =... | [
"Returns",
"the",
"specified",
"Special",
"Folder"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/drive.py#L1476-L1506 | [
"def",
"get_special_folder",
"(",
"self",
",",
"name",
")",
":",
"name",
"=",
"name",
"if",
"isinstance",
"(",
"name",
",",
"OneDriveWellKnowFolderNames",
")",
"else",
"OneDriveWellKnowFolderNames",
"(",
"name",
".",
"lower",
"(",
")",
")",
"name",
"=",
"nam... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Drive.refresh | Updates this drive with data from the server
:return: Success / Failure
:rtype: bool | O365/drive.py | def refresh(self):
""" Updates this drive with data from the server
:return: Success / Failure
:rtype: bool
"""
if self.object_id is None:
url = self.build_url(self._endpoints.get('default_drive'))
else:
url = self.build_url(
self... | def refresh(self):
""" Updates this drive with data from the server
:return: Success / Failure
:rtype: bool
"""
if self.object_id is None:
url = self.build_url(self._endpoints.get('default_drive'))
else:
url = self.build_url(
self... | [
"Updates",
"this",
"drive",
"with",
"data",
"from",
"the",
"server"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/drive.py#L1520-L1540 | [
"def",
"refresh",
"(",
"self",
")",
":",
"if",
"self",
".",
"object_id",
"is",
"None",
":",
"url",
"=",
"self",
".",
"build_url",
"(",
"self",
".",
"_endpoints",
".",
"get",
"(",
"'default_drive'",
")",
")",
"else",
":",
"url",
"=",
"self",
".",
"b... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Storage.get_default_drive | Returns a Drive instance
:param request_drive: True will make an api call to retrieve the drive
data
:return: default One Drive
:rtype: Drive | O365/drive.py | def get_default_drive(self, request_drive=False):
""" Returns a Drive instance
:param request_drive: True will make an api call to retrieve the drive
data
:return: default One Drive
:rtype: Drive
"""
if request_drive is False:
return Drive(con=self.c... | def get_default_drive(self, request_drive=False):
""" Returns a Drive instance
:param request_drive: True will make an api call to retrieve the drive
data
:return: default One Drive
:rtype: Drive
"""
if request_drive is False:
return Drive(con=self.c... | [
"Returns",
"a",
"Drive",
"instance"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/drive.py#L1656-L1679 | [
"def",
"get_default_drive",
"(",
"self",
",",
"request_drive",
"=",
"False",
")",
":",
"if",
"request_drive",
"is",
"False",
":",
"return",
"Drive",
"(",
"con",
"=",
"self",
".",
"con",
",",
"protocol",
"=",
"self",
".",
"protocol",
",",
"main_resource",
... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Storage.get_drive | Returns a Drive instance
:param drive_id: the drive_id to be retrieved
:return: Drive for the id
:rtype: Drive | O365/drive.py | def get_drive(self, drive_id):
""" Returns a Drive instance
:param drive_id: the drive_id to be retrieved
:return: Drive for the id
:rtype: Drive
"""
if not drive_id:
return None
url = self.build_url(
self._endpoints.get('get_drive').form... | def get_drive(self, drive_id):
""" Returns a Drive instance
:param drive_id: the drive_id to be retrieved
:return: Drive for the id
:rtype: Drive
"""
if not drive_id:
return None
url = self.build_url(
self._endpoints.get('get_drive').form... | [
"Returns",
"a",
"Drive",
"instance"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/drive.py#L1681-L1703 | [
"def",
"get_drive",
"(",
"self",
",",
"drive_id",
")",
":",
"if",
"not",
"drive_id",
":",
"return",
"None",
"url",
"=",
"self",
".",
"build_url",
"(",
"self",
".",
"_endpoints",
".",
"get",
"(",
"'get_drive'",
")",
".",
"format",
"(",
"id",
"=",
"dri... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Storage.get_drives | Returns a collection of drives | O365/drive.py | def get_drives(self):
""" Returns a collection of drives"""
url = self.build_url(self._endpoints.get('list_drives'))
response = self.con.get(url)
if not response:
return []
data = response.json()
# Everything received from cloud must be passed as self._clo... | def get_drives(self):
""" Returns a collection of drives"""
url = self.build_url(self._endpoints.get('list_drives'))
response = self.con.get(url)
if not response:
return []
data = response.json()
# Everything received from cloud must be passed as self._clo... | [
"Returns",
"a",
"collection",
"of",
"drives"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/drive.py#L1705-L1718 | [
"def",
"get_drives",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"build_url",
"(",
"self",
".",
"_endpoints",
".",
"get",
"(",
"'list_drives'",
")",
")",
"response",
"=",
"self",
".",
"con",
".",
"get",
"(",
"url",
")",
"if",
"not",
"response",
... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | ParsedNode.patch | Given a ParsedNodePatch, add the new information to the node. | core/dbt/contracts/graph/parsed.py | def patch(self, patch):
"""Given a ParsedNodePatch, add the new information to the node."""
# explicitly pick out the parts to update so we don't inadvertently
# step on the model name or anything
self._contents.update({
'patch_path': patch.original_file_path,
'de... | def patch(self, patch):
"""Given a ParsedNodePatch, add the new information to the node."""
# explicitly pick out the parts to update so we don't inadvertently
# step on the model name or anything
self._contents.update({
'patch_path': patch.original_file_path,
'de... | [
"Given",
"a",
"ParsedNodePatch",
"add",
"the",
"new",
"information",
"to",
"the",
"node",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/contracts/graph/parsed.py#L387-L398 | [
"def",
"patch",
"(",
"self",
",",
"patch",
")",
":",
"# explicitly pick out the parts to update so we don't inadvertently",
"# step on the model name or anything",
"self",
".",
"_contents",
".",
"update",
"(",
"{",
"'patch_path'",
":",
"patch",
".",
"original_file_path",
... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | build_edges | Build the forward and backward edges on the given list of ParsedNodes
and return them as two separate dictionaries, each mapping unique IDs to
lists of edges. | core/dbt/contracts/graph/manifest.py | def build_edges(nodes):
"""Build the forward and backward edges on the given list of ParsedNodes
and return them as two separate dictionaries, each mapping unique IDs to
lists of edges.
"""
backward_edges = {}
# pre-populate the forward edge dict for simplicity
forward_edges = {node.unique_i... | def build_edges(nodes):
"""Build the forward and backward edges on the given list of ParsedNodes
and return them as two separate dictionaries, each mapping unique IDs to
lists of edges.
"""
backward_edges = {}
# pre-populate the forward edge dict for simplicity
forward_edges = {node.unique_i... | [
"Build",
"the",
"forward",
"and",
"backward",
"edges",
"on",
"the",
"given",
"list",
"of",
"ParsedNodes",
"and",
"return",
"them",
"as",
"two",
"separate",
"dictionaries",
"each",
"mapping",
"unique",
"IDs",
"to",
"lists",
"of",
"edges",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/contracts/graph/manifest.py#L151-L163 | [
"def",
"build_edges",
"(",
"nodes",
")",
":",
"backward_edges",
"=",
"{",
"}",
"# pre-populate the forward edge dict for simplicity",
"forward_edges",
"=",
"{",
"node",
".",
"unique_id",
":",
"[",
"]",
"for",
"node",
"in",
"nodes",
"}",
"for",
"node",
"in",
"n... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | Manifest.serialize | Convert the parsed manifest to a nested dict structure that we can
safely serialize to JSON. | core/dbt/contracts/graph/manifest.py | def serialize(self):
"""Convert the parsed manifest to a nested dict structure that we can
safely serialize to JSON.
"""
forward_edges, backward_edges = build_edges(self.nodes.values())
return {
'nodes': {k: v.serialize() for k, v in self.nodes.items()},
... | def serialize(self):
"""Convert the parsed manifest to a nested dict structure that we can
safely serialize to JSON.
"""
forward_edges, backward_edges = build_edges(self.nodes.values())
return {
'nodes': {k: v.serialize() for k, v in self.nodes.items()},
... | [
"Convert",
"the",
"parsed",
"manifest",
"to",
"a",
"nested",
"dict",
"structure",
"that",
"we",
"can",
"safely",
"serialize",
"to",
"JSON",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/contracts/graph/manifest.py#L209-L224 | [
"def",
"serialize",
"(",
"self",
")",
":",
"forward_edges",
",",
"backward_edges",
"=",
"build_edges",
"(",
"self",
".",
"nodes",
".",
"values",
"(",
")",
")",
"return",
"{",
"'nodes'",
":",
"{",
"k",
":",
"v",
".",
"serialize",
"(",
")",
"for",
"k",... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | Manifest.find_macro_by_name | Find a macro in the graph by its name and package name, or None for
any package. | core/dbt/contracts/graph/manifest.py | def find_macro_by_name(self, name, package):
"""Find a macro in the graph by its name and package name, or None for
any package.
"""
return self._find_by_name(name, package, 'macros', [NodeType.Macro]) | def find_macro_by_name(self, name, package):
"""Find a macro in the graph by its name and package name, or None for
any package.
"""
return self._find_by_name(name, package, 'macros', [NodeType.Macro]) | [
"Find",
"a",
"macro",
"in",
"the",
"graph",
"by",
"its",
"name",
"and",
"package",
"name",
"or",
"None",
"for",
"any",
"package",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/contracts/graph/manifest.py#L264-L268 | [
"def",
"find_macro_by_name",
"(",
"self",
",",
"name",
",",
"package",
")",
":",
"return",
"self",
".",
"_find_by_name",
"(",
"name",
",",
"package",
",",
"'macros'",
",",
"[",
"NodeType",
".",
"Macro",
"]",
")"
] | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | Manifest.find_refable_by_name | Find any valid target for "ref()" in the graph by its name and
package name, or None for any package. | core/dbt/contracts/graph/manifest.py | def find_refable_by_name(self, name, package):
"""Find any valid target for "ref()" in the graph by its name and
package name, or None for any package.
"""
return self._find_by_name(name, package, 'nodes', NodeType.refable()) | def find_refable_by_name(self, name, package):
"""Find any valid target for "ref()" in the graph by its name and
package name, or None for any package.
"""
return self._find_by_name(name, package, 'nodes', NodeType.refable()) | [
"Find",
"any",
"valid",
"target",
"for",
"ref",
"()",
"in",
"the",
"graph",
"by",
"its",
"name",
"and",
"package",
"name",
"or",
"None",
"for",
"any",
"package",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/contracts/graph/manifest.py#L270-L274 | [
"def",
"find_refable_by_name",
"(",
"self",
",",
"name",
",",
"package",
")",
":",
"return",
"self",
".",
"_find_by_name",
"(",
"name",
",",
"package",
",",
"'nodes'",
",",
"NodeType",
".",
"refable",
"(",
")",
")"
] | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | Manifest.find_source_by_name | Find any valid target for "source()" in the graph by its name and
package name, or None for any package. | core/dbt/contracts/graph/manifest.py | def find_source_by_name(self, source_name, table_name, package):
"""Find any valid target for "source()" in the graph by its name and
package name, or None for any package.
"""
name = '{}.{}'.format(source_name, table_name)
return self._find_by_name(name, package, 'nodes', [NodeT... | def find_source_by_name(self, source_name, table_name, package):
"""Find any valid target for "source()" in the graph by its name and
package name, or None for any package.
"""
name = '{}.{}'.format(source_name, table_name)
return self._find_by_name(name, package, 'nodes', [NodeT... | [
"Find",
"any",
"valid",
"target",
"for",
"source",
"()",
"in",
"the",
"graph",
"by",
"its",
"name",
"and",
"package",
"name",
"or",
"None",
"for",
"any",
"package",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/contracts/graph/manifest.py#L276-L281 | [
"def",
"find_source_by_name",
"(",
"self",
",",
"source_name",
",",
"table_name",
",",
"package",
")",
":",
"name",
"=",
"'{}.{}'",
".",
"format",
"(",
"source_name",
",",
"table_name",
")",
"return",
"self",
".",
"_find_by_name",
"(",
"name",
",",
"package"... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | Manifest._filter_subgraph | Given a subgraph of the manifest, and a predicate, filter
the subgraph using that predicate. Generates a list of nodes. | core/dbt/contracts/graph/manifest.py | def _filter_subgraph(self, subgraph, predicate):
"""
Given a subgraph of the manifest, and a predicate, filter
the subgraph using that predicate. Generates a list of nodes.
"""
to_return = []
for unique_id, item in subgraph.items():
if predicate(item):
... | def _filter_subgraph(self, subgraph, predicate):
"""
Given a subgraph of the manifest, and a predicate, filter
the subgraph using that predicate. Generates a list of nodes.
"""
to_return = []
for unique_id, item in subgraph.items():
if predicate(item):
... | [
"Given",
"a",
"subgraph",
"of",
"the",
"manifest",
"and",
"a",
"predicate",
"filter",
"the",
"subgraph",
"using",
"that",
"predicate",
".",
"Generates",
"a",
"list",
"of",
"nodes",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/contracts/graph/manifest.py#L317-L328 | [
"def",
"_filter_subgraph",
"(",
"self",
",",
"subgraph",
",",
"predicate",
")",
":",
"to_return",
"=",
"[",
"]",
"for",
"unique_id",
",",
"item",
"in",
"subgraph",
".",
"items",
"(",
")",
":",
"if",
"predicate",
"(",
"item",
")",
":",
"to_return",
".",... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | Manifest.get_unique_ids_for_schema_and_table | Given a schema and table, find matching models, and return
their unique_ids. A schema and table may have more than one
match if the relation matches both a source and a seed, for instance. | core/dbt/contracts/graph/manifest.py | def get_unique_ids_for_schema_and_table(self, schema, table):
"""
Given a schema and table, find matching models, and return
their unique_ids. A schema and table may have more than one
match if the relation matches both a source and a seed, for instance.
"""
def predicate... | def get_unique_ids_for_schema_and_table(self, schema, table):
"""
Given a schema and table, find matching models, and return
their unique_ids. A schema and table may have more than one
match if the relation matches both a source and a seed, for instance.
"""
def predicate... | [
"Given",
"a",
"schema",
"and",
"table",
"find",
"matching",
"models",
"and",
"return",
"their",
"unique_ids",
".",
"A",
"schema",
"and",
"table",
"may",
"have",
"more",
"than",
"one",
"match",
"if",
"the",
"relation",
"matches",
"both",
"a",
"source",
"and... | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/contracts/graph/manifest.py#L337-L347 | [
"def",
"get_unique_ids_for_schema_and_table",
"(",
"self",
",",
"schema",
",",
"table",
")",
":",
"def",
"predicate",
"(",
"model",
")",
":",
"return",
"self",
".",
"_model_matches_schema_and_table",
"(",
"schema",
",",
"table",
",",
"model",
")",
"matching",
... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | Manifest.add_nodes | Add the given dict of new nodes to the manifest. | core/dbt/contracts/graph/manifest.py | def add_nodes(self, new_nodes):
"""Add the given dict of new nodes to the manifest."""
for unique_id, node in new_nodes.items():
if unique_id in self.nodes:
raise_duplicate_resource_name(node, self.nodes[unique_id])
self.nodes[unique_id] = node | def add_nodes(self, new_nodes):
"""Add the given dict of new nodes to the manifest."""
for unique_id, node in new_nodes.items():
if unique_id in self.nodes:
raise_duplicate_resource_name(node, self.nodes[unique_id])
self.nodes[unique_id] = node | [
"Add",
"the",
"given",
"dict",
"of",
"new",
"nodes",
"to",
"the",
"manifest",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/contracts/graph/manifest.py#L349-L354 | [
"def",
"add_nodes",
"(",
"self",
",",
"new_nodes",
")",
":",
"for",
"unique_id",
",",
"node",
"in",
"new_nodes",
".",
"items",
"(",
")",
":",
"if",
"unique_id",
"in",
"self",
".",
"nodes",
":",
"raise_duplicate_resource_name",
"(",
"node",
",",
"self",
"... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | Manifest.patch_nodes | Patch nodes with the given dict of patches. Note that this consumes
the input! | core/dbt/contracts/graph/manifest.py | def patch_nodes(self, patches):
"""Patch nodes with the given dict of patches. Note that this consumes
the input!
"""
# because we don't have any mapping from node _names_ to nodes, and we
# only have the node name in the patch, we have to iterate over all the
# nodes loo... | def patch_nodes(self, patches):
"""Patch nodes with the given dict of patches. Note that this consumes
the input!
"""
# because we don't have any mapping from node _names_ to nodes, and we
# only have the node name in the patch, we have to iterate over all the
# nodes loo... | [
"Patch",
"nodes",
"with",
"the",
"given",
"dict",
"of",
"patches",
".",
"Note",
"that",
"this",
"consumes",
"the",
"input!"
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/contracts/graph/manifest.py#L356-L380 | [
"def",
"patch_nodes",
"(",
"self",
",",
"patches",
")",
":",
"# because we don't have any mapping from node _names_ to nodes, and we",
"# only have the node name in the patch, we have to iterate over all the",
"# nodes looking for matching names. We could use _find_by_name if we",
"# were ok w... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | Manifest.to_flat_graph | Convert the parsed manifest to the 'flat graph' that the compiler
expects.
Kind of hacky note: everything in the code is happy to deal with
macros as ParsedMacro objects (in fact, it's been changed to require
that), so those can just be returned without any work. Nodes sadly
req... | core/dbt/contracts/graph/manifest.py | def to_flat_graph(self):
"""Convert the parsed manifest to the 'flat graph' that the compiler
expects.
Kind of hacky note: everything in the code is happy to deal with
macros as ParsedMacro objects (in fact, it's been changed to require
that), so those can just be returned witho... | def to_flat_graph(self):
"""Convert the parsed manifest to the 'flat graph' that the compiler
expects.
Kind of hacky note: everything in the code is happy to deal with
macros as ParsedMacro objects (in fact, it's been changed to require
that), so those can just be returned witho... | [
"Convert",
"the",
"parsed",
"manifest",
"to",
"the",
"flat",
"graph",
"that",
"the",
"compiler",
"expects",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/contracts/graph/manifest.py#L382-L396 | [
"def",
"to_flat_graph",
"(",
"self",
")",
":",
"return",
"{",
"'nodes'",
":",
"{",
"k",
":",
"v",
".",
"to_shallow_dict",
"(",
")",
"for",
"k",
",",
"v",
"in",
"self",
".",
"nodes",
".",
"items",
"(",
")",
"}",
",",
"'macros'",
":",
"self",
".",
... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | table_from_data | Convert list of dictionaries into an Agate table | core/dbt/clients/agate_helper.py | def table_from_data(data, column_names):
"Convert list of dictionaries into an Agate table"
# The agate table is generated from a list of dicts, so the column order
# from `data` is not preserved. We can use `select` to reorder the columns
#
# If there is no data, create an empty table with the spe... | def table_from_data(data, column_names):
"Convert list of dictionaries into an Agate table"
# The agate table is generated from a list of dicts, so the column order
# from `data` is not preserved. We can use `select` to reorder the columns
#
# If there is no data, create an empty table with the spe... | [
"Convert",
"list",
"of",
"dictionaries",
"into",
"an",
"Agate",
"table"
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/clients/agate_helper.py#L16-L28 | [
"def",
"table_from_data",
"(",
"data",
",",
"column_names",
")",
":",
"# The agate table is generated from a list of dicts, so the column order",
"# from `data` is not preserved. We can use `select` to reorder the columns",
"#",
"# If there is no data, create an empty table with the specified ... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | MacrosKnownParser.get_schema_func | The get_schema function is set by a few different things:
- if there is a 'generate_schema_name' macro in the root project,
it will be used.
- if that does not exist but there is a 'generate_schema_name'
macro in the 'dbt' internal project, that will be used
... | core/dbt/parser/base.py | def get_schema_func(self):
"""The get_schema function is set by a few different things:
- if there is a 'generate_schema_name' macro in the root project,
it will be used.
- if that does not exist but there is a 'generate_schema_name'
macro in the 'dbt' int... | def get_schema_func(self):
"""The get_schema function is set by a few different things:
- if there is a 'generate_schema_name' macro in the root project,
it will be used.
- if that does not exist but there is a 'generate_schema_name'
macro in the 'dbt' int... | [
"The",
"get_schema",
"function",
"is",
"set",
"by",
"a",
"few",
"different",
"things",
":",
"-",
"if",
"there",
"is",
"a",
"generate_schema_name",
"macro",
"in",
"the",
"root",
"project",
"it",
"will",
"be",
"used",
".",
"-",
"if",
"that",
"does",
"not",... | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/parser/base.py#L63-L96 | [
"def",
"get_schema_func",
"(",
"self",
")",
":",
"if",
"self",
".",
"_get_schema_func",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_get_schema_func",
"get_schema_macro",
"=",
"self",
".",
"macro_manifest",
".",
"find_macro_by_name",
"(",
"'generate_schema_n... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | MacrosKnownParser.get_alias_func | The get_alias function is set by a few different things:
- if there is a 'generate_alias_name' macro in the root project,
it will be used.
- if that does not exist but there is a 'generate_alias_name'
macro in the 'dbt' internal project, that will be used
... | core/dbt/parser/base.py | def get_alias_func(self):
"""The get_alias function is set by a few different things:
- if there is a 'generate_alias_name' macro in the root project,
it will be used.
- if that does not exist but there is a 'generate_alias_name'
macro in the 'dbt' interna... | def get_alias_func(self):
"""The get_alias function is set by a few different things:
- if there is a 'generate_alias_name' macro in the root project,
it will be used.
- if that does not exist but there is a 'generate_alias_name'
macro in the 'dbt' interna... | [
"The",
"get_alias",
"function",
"is",
"set",
"by",
"a",
"few",
"different",
"things",
":",
"-",
"if",
"there",
"is",
"a",
"generate_alias_name",
"macro",
"in",
"the",
"root",
"project",
"it",
"will",
"be",
"used",
".",
"-",
"if",
"that",
"does",
"not",
... | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/parser/base.py#L98-L134 | [
"def",
"get_alias_func",
"(",
"self",
")",
":",
"if",
"self",
".",
"_get_alias_func",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_get_alias_func",
"get_alias_macro",
"=",
"self",
".",
"macro_manifest",
".",
"find_macro_by_name",
"(",
"'generate_alias_name'"... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | MacrosKnownParser._build_intermediate_node_dict | Update the unparsed node dictionary and build the basis for an
intermediate ParsedNode that will be passed into the renderer | core/dbt/parser/base.py | def _build_intermediate_node_dict(self, config, node_dict, node_path,
package_project_config, tags, fqn,
agate_table, archive_config,
column_name):
"""Update the unparsed node dictionary and build t... | def _build_intermediate_node_dict(self, config, node_dict, node_path,
package_project_config, tags, fqn,
agate_table, archive_config,
column_name):
"""Update the unparsed node dictionary and build t... | [
"Update",
"the",
"unparsed",
"node",
"dictionary",
"and",
"build",
"the",
"basis",
"for",
"an",
"intermediate",
"ParsedNode",
"that",
"will",
"be",
"passed",
"into",
"the",
"renderer"
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/parser/base.py#L136-L182 | [
"def",
"_build_intermediate_node_dict",
"(",
"self",
",",
"config",
",",
"node_dict",
",",
"node_path",
",",
"package_project_config",
",",
"tags",
",",
"fqn",
",",
"agate_table",
",",
"archive_config",
",",
"column_name",
")",
":",
"# because this takes and returns d... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | MacrosKnownParser._render_with_context | Given the parsed node and a SourceConfig to use during parsing,
render the node's sql wtih macro capture enabled.
Note: this mutates the config object when config() calls are rendered. | core/dbt/parser/base.py | def _render_with_context(self, parsed_node, config):
"""Given the parsed node and a SourceConfig to use during parsing,
render the node's sql wtih macro capture enabled.
Note: this mutates the config object when config() calls are rendered.
"""
context = dbt.context.parser.gener... | def _render_with_context(self, parsed_node, config):
"""Given the parsed node and a SourceConfig to use during parsing,
render the node's sql wtih macro capture enabled.
Note: this mutates the config object when config() calls are rendered.
"""
context = dbt.context.parser.gener... | [
"Given",
"the",
"parsed",
"node",
"and",
"a",
"SourceConfig",
"to",
"use",
"during",
"parsing",
"render",
"the",
"node",
"s",
"sql",
"wtih",
"macro",
"capture",
"enabled",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/parser/base.py#L184-L198 | [
"def",
"_render_with_context",
"(",
"self",
",",
"parsed_node",
",",
"config",
")",
":",
"context",
"=",
"dbt",
".",
"context",
".",
"parser",
".",
"generate",
"(",
"parsed_node",
",",
"self",
".",
"root_project_config",
",",
"self",
".",
"macro_manifest",
"... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | MacrosKnownParser._update_parsed_node_info | Given the SourceConfig used for parsing and the parsed node,
generate and set the true values to use, overriding the temporary parse
values set in _build_intermediate_parsed_node. | core/dbt/parser/base.py | def _update_parsed_node_info(self, parsed_node, config):
"""Given the SourceConfig used for parsing and the parsed node,
generate and set the true values to use, overriding the temporary parse
values set in _build_intermediate_parsed_node.
"""
# Special macro defined in the globa... | def _update_parsed_node_info(self, parsed_node, config):
"""Given the SourceConfig used for parsing and the parsed node,
generate and set the true values to use, overriding the temporary parse
values set in _build_intermediate_parsed_node.
"""
# Special macro defined in the globa... | [
"Given",
"the",
"SourceConfig",
"used",
"for",
"parsing",
"and",
"the",
"parsed",
"node",
"generate",
"and",
"set",
"the",
"true",
"values",
"to",
"use",
"overriding",
"the",
"temporary",
"parse",
"values",
"set",
"in",
"_build_intermediate_parsed_node",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/parser/base.py#L200-L230 | [
"def",
"_update_parsed_node_info",
"(",
"self",
",",
"parsed_node",
",",
"config",
")",
":",
"# Special macro defined in the global project. Use the root project's",
"# definition, not the current package",
"schema_override",
"=",
"config",
".",
"config",
".",
"get",
"(",
"'s... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | MacrosKnownParser.parse_node | Parse a node, given an UnparsedNode and any other required information.
agate_table should be set if the node came from a seed file.
archive_config should be set if the node is an Archive node.
column_name should be set if the node is a Test node associated with a
particular column. | core/dbt/parser/base.py | def parse_node(self, node, node_path, package_project_config, tags=None,
fqn_extra=None, fqn=None, agate_table=None,
archive_config=None, column_name=None):
"""Parse a node, given an UnparsedNode and any other required information.
agate_table should be set if the ... | def parse_node(self, node, node_path, package_project_config, tags=None,
fqn_extra=None, fqn=None, agate_table=None,
archive_config=None, column_name=None):
"""Parse a node, given an UnparsedNode and any other required information.
agate_table should be set if the ... | [
"Parse",
"a",
"node",
"given",
"an",
"UnparsedNode",
"and",
"any",
"other",
"required",
"information",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/parser/base.py#L232-L267 | [
"def",
"parse_node",
"(",
"self",
",",
"node",
",",
"node_path",
",",
"package_project_config",
",",
"tags",
"=",
"None",
",",
"fqn_extra",
"=",
"None",
",",
"fqn",
"=",
"None",
",",
"agate_table",
"=",
"None",
",",
"archive_config",
"=",
"None",
",",
"c... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | MacrosKnownParser.check_block_parsing | Check if we were able to extract toplevel blocks from the given
contents. Return True if extraction was successful (no exceptions),
False if it fails. | core/dbt/parser/base.py | def check_block_parsing(self, name, path, contents):
"""Check if we were able to extract toplevel blocks from the given
contents. Return True if extraction was successful (no exceptions),
False if it fails.
"""
if not dbt.flags.TEST_NEW_PARSER:
return True
try... | def check_block_parsing(self, name, path, contents):
"""Check if we were able to extract toplevel blocks from the given
contents. Return True if extraction was successful (no exceptions),
False if it fails.
"""
if not dbt.flags.TEST_NEW_PARSER:
return True
try... | [
"Check",
"if",
"we",
"were",
"able",
"to",
"extract",
"toplevel",
"blocks",
"from",
"the",
"given",
"contents",
".",
"Return",
"True",
"if",
"extraction",
"was",
"successful",
"(",
"no",
"exceptions",
")",
"False",
"if",
"it",
"fails",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/parser/base.py#L269-L280 | [
"def",
"check_block_parsing",
"(",
"self",
",",
"name",
",",
"path",
",",
"contents",
")",
":",
"if",
"not",
"dbt",
".",
"flags",
".",
"TEST_NEW_PARSER",
":",
"return",
"True",
"try",
":",
"dbt",
".",
"clients",
".",
"jinja",
".",
"extract_toplevel_blocks"... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | BigQueryColumn.column_to_bq_schema | Convert a column to a bigquery schema object. | plugins/bigquery/dbt/adapters/bigquery/relation.py | def column_to_bq_schema(self):
"""Convert a column to a bigquery schema object.
"""
kwargs = {}
if len(self.fields) > 0:
fields = [field.column_to_bq_schema() for field in self.fields]
kwargs = {"fields": fields}
return google.cloud.bigquery.SchemaField(s... | def column_to_bq_schema(self):
"""Convert a column to a bigquery schema object.
"""
kwargs = {}
if len(self.fields) > 0:
fields = [field.column_to_bq_schema() for field in self.fields]
kwargs = {"fields": fields}
return google.cloud.bigquery.SchemaField(s... | [
"Convert",
"a",
"column",
"to",
"a",
"bigquery",
"schema",
"object",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/plugins/bigquery/dbt/adapters/bigquery/relation.py#L200-L209 | [
"def",
"column_to_bq_schema",
"(",
"self",
")",
":",
"kwargs",
"=",
"{",
"}",
"if",
"len",
"(",
"self",
".",
"fields",
")",
">",
"0",
":",
"fields",
"=",
"[",
"field",
".",
"column_to_bq_schema",
"(",
")",
"for",
"field",
"in",
"self",
".",
"fields",... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | RemoteCompileTask.runtime_cleanup | Do some pre-run cleanup that is usually performed in Task __init__. | core/dbt/task/compile.py | def runtime_cleanup(self, selected_uids):
"""Do some pre-run cleanup that is usually performed in Task __init__.
"""
self.run_count = 0
self.num_nodes = len(selected_uids)
self.node_results = []
self._skipped_children = {}
self._skipped_children = {}
self.... | def runtime_cleanup(self, selected_uids):
"""Do some pre-run cleanup that is usually performed in Task __init__.
"""
self.run_count = 0
self.num_nodes = len(selected_uids)
self.node_results = []
self._skipped_children = {}
self._skipped_children = {}
self.... | [
"Do",
"some",
"pre",
"-",
"run",
"cleanup",
"that",
"is",
"usually",
"performed",
"in",
"Task",
"__init__",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/task/compile.py#L50-L58 | [
"def",
"runtime_cleanup",
"(",
"self",
",",
"selected_uids",
")",
":",
"self",
".",
"run_count",
"=",
"0",
"self",
".",
"num_nodes",
"=",
"len",
"(",
"selected_uids",
")",
"self",
".",
"node_results",
"=",
"[",
"]",
"self",
".",
"_skipped_children",
"=",
... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | SeedParser.parse_seed_file | Parse the given seed file, returning an UnparsedNode and the agate
table. | core/dbt/parser/seeds.py | def parse_seed_file(cls, file_match, root_dir, package_name, should_parse):
"""Parse the given seed file, returning an UnparsedNode and the agate
table.
"""
abspath = file_match['absolute_path']
logger.debug("Parsing {}".format(abspath))
table_name = os.path.basename(absp... | def parse_seed_file(cls, file_match, root_dir, package_name, should_parse):
"""Parse the given seed file, returning an UnparsedNode and the agate
table.
"""
abspath = file_match['absolute_path']
logger.debug("Parsing {}".format(abspath))
table_name = os.path.basename(absp... | [
"Parse",
"the",
"given",
"seed",
"file",
"returning",
"an",
"UnparsedNode",
"and",
"the",
"agate",
"table",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/parser/seeds.py#L18-L45 | [
"def",
"parse_seed_file",
"(",
"cls",
",",
"file_match",
",",
"root_dir",
",",
"package_name",
",",
"should_parse",
")",
":",
"abspath",
"=",
"file_match",
"[",
"'absolute_path'",
"]",
"logger",
".",
"debug",
"(",
"\"Parsing {}\"",
".",
"format",
"(",
"abspath... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | SeedParser.load_and_parse | Load and parse seed files in a list of directories. Returns a dict
that maps unique ids onto ParsedNodes | core/dbt/parser/seeds.py | def load_and_parse(self, package_name, root_dir, relative_dirs, tags=None):
"""Load and parse seed files in a list of directories. Returns a dict
that maps unique ids onto ParsedNodes"""
extension = "[!.#~]*.csv"
if dbt.flags.STRICT_MODE:
dbt.contracts.project.ProjectList... | def load_and_parse(self, package_name, root_dir, relative_dirs, tags=None):
"""Load and parse seed files in a list of directories. Returns a dict
that maps unique ids onto ParsedNodes"""
extension = "[!.#~]*.csv"
if dbt.flags.STRICT_MODE:
dbt.contracts.project.ProjectList... | [
"Load",
"and",
"parse",
"seed",
"files",
"in",
"a",
"list",
"of",
"directories",
".",
"Returns",
"a",
"dict",
"that",
"maps",
"unique",
"ids",
"onto",
"ParsedNodes"
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/parser/seeds.py#L47-L74 | [
"def",
"load_and_parse",
"(",
"self",
",",
"package_name",
",",
"root_dir",
",",
"relative_dirs",
",",
"tags",
"=",
"None",
")",
":",
"extension",
"=",
"\"[!.#~]*.csv\"",
"if",
"dbt",
".",
"flags",
".",
"STRICT_MODE",
":",
"dbt",
".",
"contracts",
".",
"pr... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | get_stripped_prefix | Go through source, extracting every key/value pair where the key starts
with the given prefix. | core/dbt/task/generate.py | def get_stripped_prefix(source, prefix):
"""Go through source, extracting every key/value pair where the key starts
with the given prefix.
"""
cut = len(prefix)
return {
k[cut:]: v for k, v in source.items()
if k.startswith(prefix)
} | def get_stripped_prefix(source, prefix):
"""Go through source, extracting every key/value pair where the key starts
with the given prefix.
"""
cut = len(prefix)
return {
k[cut:]: v for k, v in source.items()
if k.startswith(prefix)
} | [
"Go",
"through",
"source",
"extracting",
"every",
"key",
"/",
"value",
"pair",
"where",
"the",
"key",
"starts",
"with",
"the",
"given",
"prefix",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/task/generate.py#L19-L27 | [
"def",
"get_stripped_prefix",
"(",
"source",
",",
"prefix",
")",
":",
"cut",
"=",
"len",
"(",
"prefix",
")",
"return",
"{",
"k",
"[",
"cut",
":",
"]",
":",
"v",
"for",
"k",
",",
"v",
"in",
"source",
".",
"items",
"(",
")",
"if",
"k",
".",
"star... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | format_stats | Given a dictionary following this layout:
{
'encoded:label': 'Encoded',
'encoded:value': 'Yes',
'encoded:description': 'Indicates if the column is encoded',
'encoded:include': True,
'size:label': 'Size',
'size:value': 128,
'si... | core/dbt/task/generate.py | def format_stats(stats):
"""Given a dictionary following this layout:
{
'encoded:label': 'Encoded',
'encoded:value': 'Yes',
'encoded:description': 'Indicates if the column is encoded',
'encoded:include': True,
'size:label': 'Size',
's... | def format_stats(stats):
"""Given a dictionary following this layout:
{
'encoded:label': 'Encoded',
'encoded:value': 'Yes',
'encoded:description': 'Indicates if the column is encoded',
'encoded:include': True,
'size:label': 'Size',
's... | [
"Given",
"a",
"dictionary",
"following",
"this",
"layout",
":"
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/task/generate.py#L30-L87 | [
"def",
"format_stats",
"(",
"stats",
")",
":",
"stats_collector",
"=",
"{",
"}",
"for",
"stat_key",
",",
"stat_value",
"in",
"stats",
".",
"items",
"(",
")",
":",
"stat_id",
",",
"stat_field",
"=",
"stat_key",
".",
"split",
"(",
"\":\"",
")",
"stats_coll... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | unflatten | Given a list of column dictionaries following this layout:
[{
'column_comment': None,
'column_index': Decimal('1'),
'column_name': 'id',
'column_type': 'integer',
'table_comment': None,
'table_name': 'test_table',
'table_schema... | core/dbt/task/generate.py | def unflatten(columns):
"""Given a list of column dictionaries following this layout:
[{
'column_comment': None,
'column_index': Decimal('1'),
'column_name': 'id',
'column_type': 'integer',
'table_comment': None,
'table_name': 'test_ta... | def unflatten(columns):
"""Given a list of column dictionaries following this layout:
[{
'column_comment': None,
'column_index': Decimal('1'),
'column_name': 'id',
'column_type': 'integer',
'table_comment': None,
'table_name': 'test_ta... | [
"Given",
"a",
"list",
"of",
"column",
"dictionaries",
"following",
"this",
"layout",
":"
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/task/generate.py#L90-L161 | [
"def",
"unflatten",
"(",
"columns",
")",
":",
"structured",
"=",
"{",
"}",
"for",
"entry",
"in",
"columns",
":",
"schema_name",
"=",
"entry",
"[",
"'table_schema'",
"]",
"table_name",
"=",
"entry",
"[",
"'table_name'",
"]",
"if",
"schema_name",
"not",
"in"... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | _add_macro_map | Update an existing context in-place, adding the given macro map to the
appropriate package namespace. Adapter packages get inserted into the
global namespace. | core/dbt/context/common.py | def _add_macro_map(context, package_name, macro_map):
"""Update an existing context in-place, adding the given macro map to the
appropriate package namespace. Adapter packages get inserted into the
global namespace.
"""
key = package_name
if package_name in PACKAGES:
key = GLOBAL_PROJECT... | def _add_macro_map(context, package_name, macro_map):
"""Update an existing context in-place, adding the given macro map to the
appropriate package namespace. Adapter packages get inserted into the
global namespace.
"""
key = package_name
if package_name in PACKAGES:
key = GLOBAL_PROJECT... | [
"Update",
"an",
"existing",
"context",
"in",
"-",
"place",
"adding",
"the",
"given",
"macro",
"map",
"to",
"the",
"appropriate",
"package",
"namespace",
".",
"Adapter",
"packages",
"get",
"inserted",
"into",
"the",
"global",
"namespace",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/context/common.py#L78-L89 | [
"def",
"_add_macro_map",
"(",
"context",
",",
"package_name",
",",
"macro_map",
")",
":",
"key",
"=",
"package_name",
"if",
"package_name",
"in",
"PACKAGES",
":",
"key",
"=",
"GLOBAL_PROJECT_NAME",
"if",
"key",
"not",
"in",
"context",
":",
"context",
"[",
"k... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | generate_base | Generate the common aspects of the config dict. | core/dbt/context/common.py | def generate_base(model, model_dict, config, manifest, source_config,
provider, adapter=None):
"""Generate the common aspects of the config dict."""
if provider is None:
raise dbt.exceptions.InternalException(
"Invalid provider given to context: {}".format(provider))
t... | def generate_base(model, model_dict, config, manifest, source_config,
provider, adapter=None):
"""Generate the common aspects of the config dict."""
if provider is None:
raise dbt.exceptions.InternalException(
"Invalid provider given to context: {}".format(provider))
t... | [
"Generate",
"the",
"common",
"aspects",
"of",
"the",
"config",
"dict",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/context/common.py#L336-L395 | [
"def",
"generate_base",
"(",
"model",
",",
"model_dict",
",",
"config",
",",
"manifest",
",",
"source_config",
",",
"provider",
",",
"adapter",
"=",
"None",
")",
":",
"if",
"provider",
"is",
"None",
":",
"raise",
"dbt",
".",
"exceptions",
".",
"InternalExc... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | generate_execute_macro | Internally, macros can be executed like nodes, with some restrictions:
- they don't have have all values available that nodes do:
- 'this', 'pre_hooks', 'post_hooks', and 'sql' are missing
- 'schema' does not use any 'model' information
- they can't be configured with config() directives | core/dbt/context/common.py | def generate_execute_macro(model, config, manifest, provider):
"""Internally, macros can be executed like nodes, with some restrictions:
- they don't have have all values available that nodes do:
- 'this', 'pre_hooks', 'post_hooks', and 'sql' are missing
- 'schema' does not use any 'model' inf... | def generate_execute_macro(model, config, manifest, provider):
"""Internally, macros can be executed like nodes, with some restrictions:
- they don't have have all values available that nodes do:
- 'this', 'pre_hooks', 'post_hooks', and 'sql' are missing
- 'schema' does not use any 'model' inf... | [
"Internally",
"macros",
"can",
"be",
"executed",
"like",
"nodes",
"with",
"some",
"restrictions",
":"
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/context/common.py#L417-L430 | [
"def",
"generate_execute_macro",
"(",
"model",
",",
"config",
",",
"manifest",
",",
"provider",
")",
":",
"model_dict",
"=",
"model",
".",
"serialize",
"(",
")",
"context",
"=",
"generate_base",
"(",
"model",
",",
"model_dict",
",",
"config",
",",
"manifest"... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | generate | Not meant to be called directly. Call with either:
dbt.context.parser.generate
or
dbt.context.runtime.generate | core/dbt/context/common.py | def generate(model, config, manifest, source_config=None, provider=None):
"""
Not meant to be called directly. Call with either:
dbt.context.parser.generate
or
dbt.context.runtime.generate
"""
return generate_model(model, config, manifest, source_config, provider) | def generate(model, config, manifest, source_config=None, provider=None):
"""
Not meant to be called directly. Call with either:
dbt.context.parser.generate
or
dbt.context.runtime.generate
"""
return generate_model(model, config, manifest, source_config, provider) | [
"Not",
"meant",
"to",
"be",
"called",
"directly",
".",
"Call",
"with",
"either",
":",
"dbt",
".",
"context",
".",
"parser",
".",
"generate",
"or",
"dbt",
".",
"context",
".",
"runtime",
".",
"generate"
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/context/common.py#L454-L461 | [
"def",
"generate",
"(",
"model",
",",
"config",
",",
"manifest",
",",
"source_config",
"=",
"None",
",",
"provider",
"=",
"None",
")",
":",
"return",
"generate_model",
"(",
"model",
",",
"config",
",",
"manifest",
",",
"source_config",
",",
"provider",
")"... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | FreshnessExecutionResult.write | Create a new object with the desired output schema and write it. | core/dbt/contracts/results.py | def write(self, path):
"""Create a new object with the desired output schema and write it."""
meta = {
'generated_at': self.generated_at,
'elapsed_time': self.elapsed_time,
}
sources = {}
for result in self.results:
unique_id = result.node.uniq... | def write(self, path):
"""Create a new object with the desired output schema and write it."""
meta = {
'generated_at': self.generated_at,
'elapsed_time': self.elapsed_time,
}
sources = {}
for result in self.results:
unique_id = result.node.uniq... | [
"Create",
"a",
"new",
"object",
"with",
"the",
"desired",
"output",
"schema",
"and",
"write",
"it",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/contracts/results.py#L343-L367 | [
"def",
"write",
"(",
"self",
",",
"path",
")",
":",
"meta",
"=",
"{",
"'generated_at'",
":",
"self",
".",
"generated_at",
",",
"'elapsed_time'",
":",
"self",
".",
"elapsed_time",
",",
"}",
"sources",
"=",
"{",
"}",
"for",
"result",
"in",
"self",
".",
... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | _make_key | Make _ReferenceKeys with lowercase values for the cache so we don't have
to keep track of quoting | core/dbt/adapters/cache.py | def _make_key(relation):
"""Make _ReferenceKeys with lowercase values for the cache so we don't have
to keep track of quoting
"""
return _ReferenceKey(_lower(relation.database),
_lower(relation.schema),
_lower(relation.identifier)) | def _make_key(relation):
"""Make _ReferenceKeys with lowercase values for the cache so we don't have
to keep track of quoting
"""
return _ReferenceKey(_lower(relation.database),
_lower(relation.schema),
_lower(relation.identifier)) | [
"Make",
"_ReferenceKeys",
"with",
"lowercase",
"values",
"for",
"the",
"cache",
"so",
"we",
"don",
"t",
"have",
"to",
"keep",
"track",
"of",
"quoting"
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/adapters/cache.py#L19-L25 | [
"def",
"_make_key",
"(",
"relation",
")",
":",
"return",
"_ReferenceKey",
"(",
"_lower",
"(",
"relation",
".",
"database",
")",
",",
"_lower",
"(",
"relation",
".",
"schema",
")",
",",
"_lower",
"(",
"relation",
".",
"identifier",
")",
")"
] | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | _CachedRelation.collect_consequences | Recursively collect a set of _ReferenceKeys that would
consequentially get dropped if this were dropped via
"drop ... cascade".
:return Set[_ReferenceKey]: All the relations that would be dropped | core/dbt/adapters/cache.py | def collect_consequences(self):
"""Recursively collect a set of _ReferenceKeys that would
consequentially get dropped if this were dropped via
"drop ... cascade".
:return Set[_ReferenceKey]: All the relations that would be dropped
"""
consequences = {self.key()}
... | def collect_consequences(self):
"""Recursively collect a set of _ReferenceKeys that would
consequentially get dropped if this were dropped via
"drop ... cascade".
:return Set[_ReferenceKey]: All the relations that would be dropped
"""
consequences = {self.key()}
... | [
"Recursively",
"collect",
"a",
"set",
"of",
"_ReferenceKeys",
"that",
"would",
"consequentially",
"get",
"dropped",
"if",
"this",
"were",
"dropped",
"via",
"drop",
"...",
"cascade",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/adapters/cache.py#L94-L104 | [
"def",
"collect_consequences",
"(",
"self",
")",
":",
"consequences",
"=",
"{",
"self",
".",
"key",
"(",
")",
"}",
"for",
"relation",
"in",
"self",
".",
"referenced_by",
".",
"values",
"(",
")",
":",
"consequences",
".",
"update",
"(",
"relation",
".",
... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | _CachedRelation.release_references | Non-recursively indicate that an iterable of _ReferenceKey no longer
exist. Unknown keys are ignored.
:param Iterable[_ReferenceKey] keys: The keys to drop. | core/dbt/adapters/cache.py | def release_references(self, keys):
"""Non-recursively indicate that an iterable of _ReferenceKey no longer
exist. Unknown keys are ignored.
:param Iterable[_ReferenceKey] keys: The keys to drop.
"""
keys = set(self.referenced_by) & set(keys)
for key in keys:
... | def release_references(self, keys):
"""Non-recursively indicate that an iterable of _ReferenceKey no longer
exist. Unknown keys are ignored.
:param Iterable[_ReferenceKey] keys: The keys to drop.
"""
keys = set(self.referenced_by) & set(keys)
for key in keys:
... | [
"Non",
"-",
"recursively",
"indicate",
"that",
"an",
"iterable",
"of",
"_ReferenceKey",
"no",
"longer",
"exist",
".",
"Unknown",
"keys",
"are",
"ignored",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/adapters/cache.py#L106-L114 | [
"def",
"release_references",
"(",
"self",
",",
"keys",
")",
":",
"keys",
"=",
"set",
"(",
"self",
".",
"referenced_by",
")",
"&",
"set",
"(",
"keys",
")",
"for",
"key",
"in",
"keys",
":",
"self",
".",
"referenced_by",
".",
"pop",
"(",
"key",
")"
] | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | _CachedRelation.rename | Rename this cached relation to new_relation.
Note that this will change the output of key(), all refs must be
updated!
:param _CachedRelation new_relation: The new name to apply to the
relation | core/dbt/adapters/cache.py | def rename(self, new_relation):
"""Rename this cached relation to new_relation.
Note that this will change the output of key(), all refs must be
updated!
:param _CachedRelation new_relation: The new name to apply to the
relation
"""
# Relations store this stu... | def rename(self, new_relation):
"""Rename this cached relation to new_relation.
Note that this will change the output of key(), all refs must be
updated!
:param _CachedRelation new_relation: The new name to apply to the
relation
"""
# Relations store this stu... | [
"Rename",
"this",
"cached",
"relation",
"to",
"new_relation",
".",
"Note",
"that",
"this",
"will",
"change",
"the",
"output",
"of",
"key",
"()",
"all",
"refs",
"must",
"be",
"updated!"
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/adapters/cache.py#L116-L135 | [
"def",
"rename",
"(",
"self",
",",
"new_relation",
")",
":",
"# Relations store this stuff inside their `path` dict. But they",
"# also store a table_name, and usually use it in their .render(),",
"# so we need to update that as well. It doesn't appear that",
"# table_name is ever anything bu... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | _CachedRelation.rename_key | Rename a reference that may or may not exist. Only handles the
reference itself, so this is the other half of what `rename` does.
If old_key is not in referenced_by, this is a no-op.
:param _ReferenceKey old_key: The old key to be renamed.
:param _ReferenceKey new_key: The new key to r... | core/dbt/adapters/cache.py | def rename_key(self, old_key, new_key):
"""Rename a reference that may or may not exist. Only handles the
reference itself, so this is the other half of what `rename` does.
If old_key is not in referenced_by, this is a no-op.
:param _ReferenceKey old_key: The old key to be renamed.
... | def rename_key(self, old_key, new_key):
"""Rename a reference that may or may not exist. Only handles the
reference itself, so this is the other half of what `rename` does.
If old_key is not in referenced_by, this is a no-op.
:param _ReferenceKey old_key: The old key to be renamed.
... | [
"Rename",
"a",
"reference",
"that",
"may",
"or",
"may",
"not",
"exist",
".",
"Only",
"handles",
"the",
"reference",
"itself",
"so",
"this",
"is",
"the",
"other",
"half",
"of",
"what",
"rename",
"does",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/adapters/cache.py#L137-L156 | [
"def",
"rename_key",
"(",
"self",
",",
"old_key",
",",
"new_key",
")",
":",
"if",
"new_key",
"in",
"self",
".",
"referenced_by",
":",
"dbt",
".",
"exceptions",
".",
"raise_cache_inconsistent",
"(",
"'in rename of \"{}\" -> \"{}\", new name is in the cache already'",
"... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | RelationsCache.add_schema | Add a schema to the set of known schemas (case-insensitive)
:param str database: The database name to add.
:param str schema: The schema name to add. | core/dbt/adapters/cache.py | def add_schema(self, database, schema):
"""Add a schema to the set of known schemas (case-insensitive)
:param str database: The database name to add.
:param str schema: The schema name to add.
"""
self.schemas.add((_lower(database), _lower(schema))) | def add_schema(self, database, schema):
"""Add a schema to the set of known schemas (case-insensitive)
:param str database: The database name to add.
:param str schema: The schema name to add.
"""
self.schemas.add((_lower(database), _lower(schema))) | [
"Add",
"a",
"schema",
"to",
"the",
"set",
"of",
"known",
"schemas",
"(",
"case",
"-",
"insensitive",
")"
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/adapters/cache.py#L180-L186 | [
"def",
"add_schema",
"(",
"self",
",",
"database",
",",
"schema",
")",
":",
"self",
".",
"schemas",
".",
"add",
"(",
"(",
"_lower",
"(",
"database",
")",
",",
"_lower",
"(",
"schema",
")",
")",
")"
] | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | RelationsCache.remove_schema | Remove a schema from the set of known schemas (case-insensitive)
If the schema does not exist, it will be ignored - it could just be a
temporary table.
:param str database: The database name to remove.
:param str schema: The schema name to remove. | core/dbt/adapters/cache.py | def remove_schema(self, database, schema):
"""Remove a schema from the set of known schemas (case-insensitive)
If the schema does not exist, it will be ignored - it could just be a
temporary table.
:param str database: The database name to remove.
:param str schema: The schema ... | def remove_schema(self, database, schema):
"""Remove a schema from the set of known schemas (case-insensitive)
If the schema does not exist, it will be ignored - it could just be a
temporary table.
:param str database: The database name to remove.
:param str schema: The schema ... | [
"Remove",
"a",
"schema",
"from",
"the",
"set",
"of",
"known",
"schemas",
"(",
"case",
"-",
"insensitive",
")"
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/adapters/cache.py#L188-L197 | [
"def",
"remove_schema",
"(",
"self",
",",
"database",
",",
"schema",
")",
":",
"self",
".",
"schemas",
".",
"discard",
"(",
"(",
"_lower",
"(",
"database",
")",
",",
"_lower",
"(",
"schema",
")",
")",
")"
] | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | RelationsCache.update_schemas | Add multiple schemas to the set of known schemas (case-insensitive)
:param Iterable[str] schemas: An iterable of the schema names to add. | core/dbt/adapters/cache.py | def update_schemas(self, schemas):
"""Add multiple schemas to the set of known schemas (case-insensitive)
:param Iterable[str] schemas: An iterable of the schema names to add.
"""
self.schemas.update((_lower(d), _lower(s)) for (d, s) in schemas) | def update_schemas(self, schemas):
"""Add multiple schemas to the set of known schemas (case-insensitive)
:param Iterable[str] schemas: An iterable of the schema names to add.
"""
self.schemas.update((_lower(d), _lower(s)) for (d, s) in schemas) | [
"Add",
"multiple",
"schemas",
"to",
"the",
"set",
"of",
"known",
"schemas",
"(",
"case",
"-",
"insensitive",
")"
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/adapters/cache.py#L199-L204 | [
"def",
"update_schemas",
"(",
"self",
",",
"schemas",
")",
":",
"self",
".",
"schemas",
".",
"update",
"(",
"(",
"_lower",
"(",
"d",
")",
",",
"_lower",
"(",
"s",
")",
")",
"for",
"(",
"d",
",",
"s",
")",
"in",
"schemas",
")"
] | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | RelationsCache.dump_graph | Dump a key-only representation of the schema to a dictionary. Every
known relation is a key with a value of a list of keys it is referenced
by. | core/dbt/adapters/cache.py | def dump_graph(self):
"""Dump a key-only representation of the schema to a dictionary. Every
known relation is a key with a value of a list of keys it is referenced
by.
"""
# we have to hold the lock for the entire dump, if other threads modify
# self.relations or any cac... | def dump_graph(self):
"""Dump a key-only representation of the schema to a dictionary. Every
known relation is a key with a value of a list of keys it is referenced
by.
"""
# we have to hold the lock for the entire dump, if other threads modify
# self.relations or any cac... | [
"Dump",
"a",
"key",
"-",
"only",
"representation",
"of",
"the",
"schema",
"to",
"a",
"dictionary",
".",
"Every",
"known",
"relation",
"is",
"a",
"key",
"with",
"a",
"value",
"of",
"a",
"list",
"of",
"keys",
"it",
"is",
"referenced",
"by",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/adapters/cache.py#L215-L227 | [
"def",
"dump_graph",
"(",
"self",
")",
":",
"# we have to hold the lock for the entire dump, if other threads modify",
"# self.relations or any cache entry's referenced_by during iteration",
"# it's a runtime error!",
"with",
"self",
".",
"lock",
":",
"return",
"{",
"dot_separated",
... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | RelationsCache._setdefault | Add a relation to the cache, or return it if it already exists.
:param _CachedRelation relation: The relation to set or get.
:return _CachedRelation: The relation stored under the given relation's
key | core/dbt/adapters/cache.py | def _setdefault(self, relation):
"""Add a relation to the cache, or return it if it already exists.
:param _CachedRelation relation: The relation to set or get.
:return _CachedRelation: The relation stored under the given relation's
key
"""
self.add_schema(relation.d... | def _setdefault(self, relation):
"""Add a relation to the cache, or return it if it already exists.
:param _CachedRelation relation: The relation to set or get.
:return _CachedRelation: The relation stored under the given relation's
key
"""
self.add_schema(relation.d... | [
"Add",
"a",
"relation",
"to",
"the",
"cache",
"or",
"return",
"it",
"if",
"it",
"already",
"exists",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/adapters/cache.py#L229-L238 | [
"def",
"_setdefault",
"(",
"self",
",",
"relation",
")",
":",
"self",
".",
"add_schema",
"(",
"relation",
".",
"database",
",",
"relation",
".",
"schema",
")",
"key",
"=",
"relation",
".",
"key",
"(",
")",
"return",
"self",
".",
"relations",
".",
"setd... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | RelationsCache._add_link | Add a link between two relations to the database. Both the old and
new entries must alraedy exist in the database.
:param _ReferenceKey referenced_key: The key identifying the referenced
model (the one that if dropped will drop the dependent model).
:param _ReferenceKey dependent_ke... | core/dbt/adapters/cache.py | def _add_link(self, referenced_key, dependent_key):
"""Add a link between two relations to the database. Both the old and
new entries must alraedy exist in the database.
:param _ReferenceKey referenced_key: The key identifying the referenced
model (the one that if dropped will drop ... | def _add_link(self, referenced_key, dependent_key):
"""Add a link between two relations to the database. Both the old and
new entries must alraedy exist in the database.
:param _ReferenceKey referenced_key: The key identifying the referenced
model (the one that if dropped will drop ... | [
"Add",
"a",
"link",
"between",
"two",
"relations",
"to",
"the",
"database",
".",
"Both",
"the",
"old",
"and",
"new",
"entries",
"must",
"alraedy",
"exist",
"in",
"the",
"database",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/adapters/cache.py#L240-L264 | [
"def",
"_add_link",
"(",
"self",
",",
"referenced_key",
",",
"dependent_key",
")",
":",
"referenced",
"=",
"self",
".",
"relations",
".",
"get",
"(",
"referenced_key",
")",
"if",
"referenced",
"is",
"None",
":",
"dbt",
".",
"exceptions",
".",
"raise_cache_in... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | RelationsCache.add_link | Add a link between two relations to the database. Both the old and
new entries must already exist in the database.
The dependent model refers _to_ the referenced model. So, given
arguments of (jake_test, bar, jake_test, foo):
both values are in the schema jake_test and foo is a view tha... | core/dbt/adapters/cache.py | def add_link(self, referenced, dependent):
"""Add a link between two relations to the database. Both the old and
new entries must already exist in the database.
The dependent model refers _to_ the referenced model. So, given
arguments of (jake_test, bar, jake_test, foo):
both va... | def add_link(self, referenced, dependent):
"""Add a link between two relations to the database. Both the old and
new entries must already exist in the database.
The dependent model refers _to_ the referenced model. So, given
arguments of (jake_test, bar, jake_test, foo):
both va... | [
"Add",
"a",
"link",
"between",
"two",
"relations",
"to",
"the",
"database",
".",
"Both",
"the",
"old",
"and",
"new",
"entries",
"must",
"already",
"exist",
"in",
"the",
"database",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/adapters/cache.py#L266-L296 | [
"def",
"add_link",
"(",
"self",
",",
"referenced",
",",
"dependent",
")",
":",
"referenced",
"=",
"_make_key",
"(",
"referenced",
")",
"if",
"(",
"referenced",
".",
"database",
",",
"referenced",
".",
"schema",
")",
"not",
"in",
"self",
":",
"# if we have ... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | RelationsCache.add | Add the relation inner to the cache, under the schema schema and
identifier identifier
:param BaseRelation relation: The underlying relation. | core/dbt/adapters/cache.py | def add(self, relation):
"""Add the relation inner to the cache, under the schema schema and
identifier identifier
:param BaseRelation relation: The underlying relation.
"""
cached = _CachedRelation(relation)
logger.debug('Adding relation: {!s}'.format(cached))
l... | def add(self, relation):
"""Add the relation inner to the cache, under the schema schema and
identifier identifier
:param BaseRelation relation: The underlying relation.
"""
cached = _CachedRelation(relation)
logger.debug('Adding relation: {!s}'.format(cached))
l... | [
"Add",
"the",
"relation",
"inner",
"to",
"the",
"cache",
"under",
"the",
"schema",
"schema",
"and",
"identifier",
"identifier"
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/adapters/cache.py#L298-L313 | [
"def",
"add",
"(",
"self",
",",
"relation",
")",
":",
"cached",
"=",
"_CachedRelation",
"(",
"relation",
")",
"logger",
".",
"debug",
"(",
"'Adding relation: {!s}'",
".",
"format",
"(",
"cached",
")",
")",
"logger",
".",
"debug",
"(",
"'before adding: {}'",
... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | RelationsCache._remove_refs | Removes all references to all entries in keys. This does not
cascade!
:param Iterable[_ReferenceKey] keys: The keys to remove. | core/dbt/adapters/cache.py | def _remove_refs(self, keys):
"""Removes all references to all entries in keys. This does not
cascade!
:param Iterable[_ReferenceKey] keys: The keys to remove.
"""
# remove direct refs
for key in keys:
del self.relations[key]
# then remove all entries... | def _remove_refs(self, keys):
"""Removes all references to all entries in keys. This does not
cascade!
:param Iterable[_ReferenceKey] keys: The keys to remove.
"""
# remove direct refs
for key in keys:
del self.relations[key]
# then remove all entries... | [
"Removes",
"all",
"references",
"to",
"all",
"entries",
"in",
"keys",
".",
"This",
"does",
"not",
"cascade!"
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/adapters/cache.py#L315-L326 | [
"def",
"_remove_refs",
"(",
"self",
",",
"keys",
")",
":",
"# remove direct refs",
"for",
"key",
"in",
"keys",
":",
"del",
"self",
".",
"relations",
"[",
"key",
"]",
"# then remove all entries from each child",
"for",
"cached",
"in",
"self",
".",
"relations",
... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | RelationsCache._drop_cascade_relation | Drop the given relation and cascade it appropriately to all
dependent relations.
:param _CachedRelation dropped: An existing _CachedRelation to drop. | core/dbt/adapters/cache.py | def _drop_cascade_relation(self, dropped):
"""Drop the given relation and cascade it appropriately to all
dependent relations.
:param _CachedRelation dropped: An existing _CachedRelation to drop.
"""
if dropped not in self.relations:
logger.debug('dropped a nonexiste... | def _drop_cascade_relation(self, dropped):
"""Drop the given relation and cascade it appropriately to all
dependent relations.
:param _CachedRelation dropped: An existing _CachedRelation to drop.
"""
if dropped not in self.relations:
logger.debug('dropped a nonexiste... | [
"Drop",
"the",
"given",
"relation",
"and",
"cascade",
"it",
"appropriately",
"to",
"all",
"dependent",
"relations",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/adapters/cache.py#L328-L342 | [
"def",
"_drop_cascade_relation",
"(",
"self",
",",
"dropped",
")",
":",
"if",
"dropped",
"not",
"in",
"self",
".",
"relations",
":",
"logger",
".",
"debug",
"(",
"'dropped a nonexistent relationship: {!s}'",
".",
"format",
"(",
"dropped",
")",
")",
"return",
"... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | RelationsCache.drop | Drop the named relation and cascade it appropriately to all
dependent relations.
Because dbt proactively does many `drop relation if exist ... cascade`
that are noops, nonexistent relation drops cause a debug log and no
other actions.
:param str schema: The schema of the relati... | core/dbt/adapters/cache.py | def drop(self, relation):
"""Drop the named relation and cascade it appropriately to all
dependent relations.
Because dbt proactively does many `drop relation if exist ... cascade`
that are noops, nonexistent relation drops cause a debug log and no
other actions.
:param... | def drop(self, relation):
"""Drop the named relation and cascade it appropriately to all
dependent relations.
Because dbt proactively does many `drop relation if exist ... cascade`
that are noops, nonexistent relation drops cause a debug log and no
other actions.
:param... | [
"Drop",
"the",
"named",
"relation",
"and",
"cascade",
"it",
"appropriately",
"to",
"all",
"dependent",
"relations",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/adapters/cache.py#L344-L358 | [
"def",
"drop",
"(",
"self",
",",
"relation",
")",
":",
"dropped",
"=",
"_make_key",
"(",
"relation",
")",
"logger",
".",
"debug",
"(",
"'Dropping relation: {!s}'",
".",
"format",
"(",
"dropped",
")",
")",
"with",
"self",
".",
"lock",
":",
"self",
".",
... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | RelationsCache._rename_relation | Rename a relation named old_key to new_key, updating references.
Return whether or not there was a key to rename.
:param _ReferenceKey old_key: The existing key, to rename from.
:param _CachedRelation new_key: The new relation, to rename to. | core/dbt/adapters/cache.py | def _rename_relation(self, old_key, new_relation):
"""Rename a relation named old_key to new_key, updating references.
Return whether or not there was a key to rename.
:param _ReferenceKey old_key: The existing key, to rename from.
:param _CachedRelation new_key: The new relation, to re... | def _rename_relation(self, old_key, new_relation):
"""Rename a relation named old_key to new_key, updating references.
Return whether or not there was a key to rename.
:param _ReferenceKey old_key: The existing key, to rename from.
:param _CachedRelation new_key: The new relation, to re... | [
"Rename",
"a",
"relation",
"named",
"old_key",
"to",
"new_key",
"updating",
"references",
".",
"Return",
"whether",
"or",
"not",
"there",
"was",
"a",
"key",
"to",
"rename",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/adapters/cache.py#L360-L390 | [
"def",
"_rename_relation",
"(",
"self",
",",
"old_key",
",",
"new_relation",
")",
":",
"# On the database level, a rename updates all values that were",
"# previously referenced by old_name to be referenced by new_name.",
"# basically, the name changes but some underlying ID moves. Kind of",... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | RelationsCache._check_rename_constraints | Check the rename constraints, and return whether or not the rename
can proceed.
If the new key is already present, that is an error.
If the old key is absent, we debug log and return False, assuming it's
a temp table being renamed.
:param _ReferenceKey old_key: The existing key... | core/dbt/adapters/cache.py | def _check_rename_constraints(self, old_key, new_key):
"""Check the rename constraints, and return whether or not the rename
can proceed.
If the new key is already present, that is an error.
If the old key is absent, we debug log and return False, assuming it's
a temp table bein... | def _check_rename_constraints(self, old_key, new_key):
"""Check the rename constraints, and return whether or not the rename
can proceed.
If the new key is already present, that is an error.
If the old key is absent, we debug log and return False, assuming it's
a temp table bein... | [
"Check",
"the",
"rename",
"constraints",
"and",
"return",
"whether",
"or",
"not",
"the",
"rename",
"can",
"proceed",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/adapters/cache.py#L392-L417 | [
"def",
"_check_rename_constraints",
"(",
"self",
",",
"old_key",
",",
"new_key",
")",
":",
"if",
"new_key",
"in",
"self",
".",
"relations",
":",
"dbt",
".",
"exceptions",
".",
"raise_cache_inconsistent",
"(",
"'in rename, new key {} already in cache: {}'",
".",
"for... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | RelationsCache.rename | Rename the old schema/identifier to the new schema/identifier and
update references.
If the new schema/identifier is already present, that is an error.
If the schema/identifier key is absent, we only debug log and return,
assuming it's a temp table being renamed.
:param BaseRel... | core/dbt/adapters/cache.py | def rename(self, old, new):
"""Rename the old schema/identifier to the new schema/identifier and
update references.
If the new schema/identifier is already present, that is an error.
If the schema/identifier key is absent, we only debug log and return,
assuming it's a temp table... | def rename(self, old, new):
"""Rename the old schema/identifier to the new schema/identifier and
update references.
If the new schema/identifier is already present, that is an error.
If the schema/identifier key is absent, we only debug log and return,
assuming it's a temp table... | [
"Rename",
"the",
"old",
"schema",
"/",
"identifier",
"to",
"the",
"new",
"schema",
"/",
"identifier",
"and",
"update",
"references",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/adapters/cache.py#L419-L448 | [
"def",
"rename",
"(",
"self",
",",
"old",
",",
"new",
")",
":",
"old_key",
"=",
"_make_key",
"(",
"old",
")",
"new_key",
"=",
"_make_key",
"(",
"new",
")",
"logger",
".",
"debug",
"(",
"'Renaming relation {!s} to {!s}'",
".",
"format",
"(",
"old_key",
",... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | RelationsCache.get_relations | Case-insensitively yield all relations matching the given schema.
:param str schema: The case-insensitive schema name to list from.
:return List[BaseRelation]: The list of relations with the given
schema | core/dbt/adapters/cache.py | def get_relations(self, database, schema):
"""Case-insensitively yield all relations matching the given schema.
:param str schema: The case-insensitive schema name to list from.
:return List[BaseRelation]: The list of relations with the given
schema
"""
schema = _low... | def get_relations(self, database, schema):
"""Case-insensitively yield all relations matching the given schema.
:param str schema: The case-insensitive schema name to list from.
:return List[BaseRelation]: The list of relations with the given
schema
"""
schema = _low... | [
"Case",
"-",
"insensitively",
"yield",
"all",
"relations",
"matching",
"the",
"given",
"schema",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/adapters/cache.py#L450-L469 | [
"def",
"get_relations",
"(",
"self",
",",
"database",
",",
"schema",
")",
":",
"schema",
"=",
"_lower",
"(",
"schema",
")",
"with",
"self",
".",
"lock",
":",
"results",
"=",
"[",
"r",
".",
"inner",
"for",
"r",
"in",
"self",
".",
"relations",
".",
"... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | RelationsCache.clear | Clear the cache | core/dbt/adapters/cache.py | def clear(self):
"""Clear the cache"""
with self.lock:
self.relations.clear()
self.schemas.clear() | def clear(self):
"""Clear the cache"""
with self.lock:
self.relations.clear()
self.schemas.clear() | [
"Clear",
"the",
"cache"
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/adapters/cache.py#L471-L475 | [
"def",
"clear",
"(",
"self",
")",
":",
"with",
"self",
".",
"lock",
":",
"self",
".",
"relations",
".",
"clear",
"(",
")",
"self",
".",
"schemas",
".",
"clear",
"(",
")"
] | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | SnowflakeConnectionManager._split_queries | Splits sql statements at semicolons into discrete queries | plugins/snowflake/dbt/adapters/snowflake/connections.py | def _split_queries(cls, sql):
"Splits sql statements at semicolons into discrete queries"
sql_s = dbt.compat.to_string(sql)
sql_buf = StringIO(sql_s)
split_query = snowflake.connector.util_text.split_statements(sql_buf)
return [part[0] for part in split_query] | def _split_queries(cls, sql):
"Splits sql statements at semicolons into discrete queries"
sql_s = dbt.compat.to_string(sql)
sql_buf = StringIO(sql_s)
split_query = snowflake.connector.util_text.split_statements(sql_buf)
return [part[0] for part in split_query] | [
"Splits",
"sql",
"statements",
"at",
"semicolons",
"into",
"discrete",
"queries"
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/plugins/snowflake/dbt/adapters/snowflake/connections.py#L174-L180 | [
"def",
"_split_queries",
"(",
"cls",
",",
"sql",
")",
":",
"sql_s",
"=",
"dbt",
".",
"compat",
".",
"to_string",
"(",
"sql",
")",
"sql_buf",
"=",
"StringIO",
"(",
"sql_s",
")",
"split_query",
"=",
"snowflake",
".",
"connector",
".",
"util_text",
".",
"... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | SnowflakeConnectionManager._get_private_key | Get Snowflake private key by path or None. | plugins/snowflake/dbt/adapters/snowflake/connections.py | def _get_private_key(cls, private_key_path, private_key_passphrase):
"""Get Snowflake private key by path or None."""
if private_key_path is None or private_key_passphrase is None:
return None
with open(private_key_path, 'rb') as key:
p_key = serialization.load_pem_priva... | def _get_private_key(cls, private_key_path, private_key_passphrase):
"""Get Snowflake private key by path or None."""
if private_key_path is None or private_key_passphrase is None:
return None
with open(private_key_path, 'rb') as key:
p_key = serialization.load_pem_priva... | [
"Get",
"Snowflake",
"private",
"key",
"by",
"path",
"or",
"None",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/plugins/snowflake/dbt/adapters/snowflake/connections.py#L183-L197 | [
"def",
"_get_private_key",
"(",
"cls",
",",
"private_key_path",
",",
"private_key_passphrase",
")",
":",
"if",
"private_key_path",
"is",
"None",
"or",
"private_key_passphrase",
"is",
"None",
":",
"return",
"None",
"with",
"open",
"(",
"private_key_path",
",",
"'rb... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | SnowflakeConnectionManager._rollback_handle | On snowflake, rolling back the handle of an aborted session raises
an exception. | plugins/snowflake/dbt/adapters/snowflake/connections.py | def _rollback_handle(cls, connection):
"""On snowflake, rolling back the handle of an aborted session raises
an exception.
"""
try:
connection.handle.rollback()
except snowflake.connector.errors.ProgrammingError as e:
msg = dbt.compat.to_string(e)
... | def _rollback_handle(cls, connection):
"""On snowflake, rolling back the handle of an aborted session raises
an exception.
"""
try:
connection.handle.rollback()
except snowflake.connector.errors.ProgrammingError as e:
msg = dbt.compat.to_string(e)
... | [
"On",
"snowflake",
"rolling",
"back",
"the",
"handle",
"of",
"an",
"aborted",
"session",
"raises",
"an",
"exception",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/plugins/snowflake/dbt/adapters/snowflake/connections.py#L242-L251 | [
"def",
"_rollback_handle",
"(",
"cls",
",",
"connection",
")",
":",
"try",
":",
"connection",
".",
"handle",
".",
"rollback",
"(",
")",
"except",
"snowflake",
".",
"connector",
".",
"errors",
".",
"ProgrammingError",
"as",
"e",
":",
"msg",
"=",
"dbt",
".... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | _filter_validate | Generator for validate() results called against all given values. On
errors, fields are warned about and ignored, unless strict mode is set in
which case a compiler error is raised. | core/dbt/parser/schemas.py | def _filter_validate(filepath, location, values, validate):
"""Generator for validate() results called against all given values. On
errors, fields are warned about and ignored, unless strict mode is set in
which case a compiler error is raised.
"""
for value in values:
if not isinstance(valu... | def _filter_validate(filepath, location, values, validate):
"""Generator for validate() results called against all given values. On
errors, fields are warned about and ignored, unless strict mode is set in
which case a compiler error is raised.
"""
for value in values:
if not isinstance(valu... | [
"Generator",
"for",
"validate",
"()",
"results",
"called",
"against",
"all",
"given",
"values",
".",
"On",
"errors",
"fields",
"are",
"warned",
"about",
"and",
"ignored",
"unless",
"strict",
"mode",
"is",
"set",
"in",
"which",
"case",
"a",
"compiler",
"error... | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/parser/schemas.py#L183-L198 | [
"def",
"_filter_validate",
"(",
"filepath",
",",
"location",
",",
"values",
",",
"validate",
")",
":",
"for",
"value",
"in",
"values",
":",
"if",
"not",
"isinstance",
"(",
"value",
",",
"dict",
")",
":",
"warn_invalid",
"(",
"filepath",
",",
"location",
... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | SchemaModelParser.parse_all | Parse all the model dictionaries in models.
:param List[dict] models: The `models` section of the schema.yml, as a
list of dicts.
:param str path: The path to the schema.yml file
:param str package_name: The name of the current package
:param str root_dir: The root directory... | core/dbt/parser/schemas.py | def parse_all(self, models, path, package_name, root_dir):
"""Parse all the model dictionaries in models.
:param List[dict] models: The `models` section of the schema.yml, as a
list of dicts.
:param str path: The path to the schema.yml file
:param str package_name: The name ... | def parse_all(self, models, path, package_name, root_dir):
"""Parse all the model dictionaries in models.
:param List[dict] models: The `models` section of the schema.yml, as a
list of dicts.
:param str path: The path to the schema.yml file
:param str package_name: The name ... | [
"Parse",
"all",
"the",
"model",
"dictionaries",
"in",
"models",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/parser/schemas.py#L365-L380 | [
"def",
"parse_all",
"(",
"self",
",",
"models",
",",
"path",
",",
"package_name",
",",
"root_dir",
")",
":",
"filtered",
"=",
"_filter_validate",
"(",
"path",
",",
"'models'",
",",
"models",
",",
"UnparsedNodeUpdate",
")",
"nodes",
"=",
"itertools",
".",
"... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | SchemaSourceParser.parse_all | Parse all the model dictionaries in sources.
:param List[dict] sources: The `sources` section of the schema.yml, as
a list of dicts.
:param str path: The path to the schema.yml file
:param str package_name: The name of the current package
:param str root_dir: The root direct... | core/dbt/parser/schemas.py | def parse_all(self, sources, path, package_name, root_dir):
"""Parse all the model dictionaries in sources.
:param List[dict] sources: The `sources` section of the schema.yml, as
a list of dicts.
:param str path: The path to the schema.yml file
:param str package_name: The n... | def parse_all(self, sources, path, package_name, root_dir):
"""Parse all the model dictionaries in sources.
:param List[dict] sources: The `sources` section of the schema.yml, as
a list of dicts.
:param str path: The path to the schema.yml file
:param str package_name: The n... | [
"Parse",
"all",
"the",
"model",
"dictionaries",
"in",
"sources",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/parser/schemas.py#L494-L511 | [
"def",
"parse_all",
"(",
"self",
",",
"sources",
",",
"path",
",",
"package_name",
",",
"root_dir",
")",
":",
"filtered",
"=",
"_filter_validate",
"(",
"path",
",",
"'sources'",
",",
"sources",
",",
"self",
".",
"_sources_validate",
")",
"nodes",
"=",
"ite... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | SchemaParser.find_schema_yml | This is common to both v1 and v2 - look through the relative_dirs
under root_dir for .yml files yield pairs of filepath and loaded yaml
contents. | core/dbt/parser/schemas.py | def find_schema_yml(cls, package_name, root_dir, relative_dirs):
"""This is common to both v1 and v2 - look through the relative_dirs
under root_dir for .yml files yield pairs of filepath and loaded yaml
contents.
"""
extension = "[!.#~]*.yml"
file_matches = dbt.clients.... | def find_schema_yml(cls, package_name, root_dir, relative_dirs):
"""This is common to both v1 and v2 - look through the relative_dirs
under root_dir for .yml files yield pairs of filepath and loaded yaml
contents.
"""
extension = "[!.#~]*.yml"
file_matches = dbt.clients.... | [
"This",
"is",
"common",
"to",
"both",
"v1",
"and",
"v2",
"-",
"look",
"through",
"the",
"relative_dirs",
"under",
"root_dir",
"for",
".",
"yml",
"files",
"yield",
"pairs",
"of",
"filepath",
"and",
"loaded",
"yaml",
"contents",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/parser/schemas.py#L521-L553 | [
"def",
"find_schema_yml",
"(",
"cls",
",",
"package_name",
",",
"root_dir",
",",
"relative_dirs",
")",
":",
"extension",
"=",
"\"[!.#~]*.yml\"",
"file_matches",
"=",
"dbt",
".",
"clients",
".",
"system",
".",
"find_matching",
"(",
"root_dir",
",",
"relative_dirs... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | _subset_graph | Create and return a new graph that is a shallow copy of graph but with
only the nodes in include_nodes. Transitive edges across removed nodes are
preserved as explicit new edges. | core/dbt/linker.py | def _subset_graph(graph, include_nodes):
"""Create and return a new graph that is a shallow copy of graph but with
only the nodes in include_nodes. Transitive edges across removed nodes are
preserved as explicit new edges.
"""
new_graph = nx.algorithms.transitive_closure(graph)
include_nodes = ... | def _subset_graph(graph, include_nodes):
"""Create and return a new graph that is a shallow copy of graph but with
only the nodes in include_nodes. Transitive edges across removed nodes are
preserved as explicit new edges.
"""
new_graph = nx.algorithms.transitive_closure(graph)
include_nodes = ... | [
"Create",
"and",
"return",
"a",
"new",
"graph",
"that",
"is",
"a",
"shallow",
"copy",
"of",
"graph",
"but",
"with",
"only",
"the",
"nodes",
"in",
"include_nodes",
".",
"Transitive",
"edges",
"across",
"removed",
"nodes",
"are",
"preserved",
"as",
"explicit",... | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/linker.py#L175-L194 | [
"def",
"_subset_graph",
"(",
"graph",
",",
"include_nodes",
")",
":",
"new_graph",
"=",
"nx",
".",
"algorithms",
".",
"transitive_closure",
"(",
"graph",
")",
"include_nodes",
"=",
"set",
"(",
"include_nodes",
")",
"for",
"node",
"in",
"graph",
".",
"nodes",... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | GraphQueue._calculate_scores | Calculate the 'value' of each node in the graph based on how many
blocking descendants it has. We use this score for the internal
priority queue's ordering, so the quality of this metric is important.
The score is stored as a negative number because the internal
PriorityQueue picks lowe... | core/dbt/linker.py | def _calculate_scores(self):
"""Calculate the 'value' of each node in the graph based on how many
blocking descendants it has. We use this score for the internal
priority queue's ordering, so the quality of this metric is important.
The score is stored as a negative number because the i... | def _calculate_scores(self):
"""Calculate the 'value' of each node in the graph based on how many
blocking descendants it has. We use this score for the internal
priority queue's ordering, so the quality of this metric is important.
The score is stored as a negative number because the i... | [
"Calculate",
"the",
"value",
"of",
"each",
"node",
"in",
"the",
"graph",
"based",
"on",
"how",
"many",
"blocking",
"descendants",
"it",
"has",
".",
"We",
"use",
"this",
"score",
"for",
"the",
"internal",
"priority",
"queue",
"s",
"ordering",
"so",
"the",
... | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/linker.py#L60-L84 | [
"def",
"_calculate_scores",
"(",
"self",
")",
":",
"scores",
"=",
"{",
"}",
"for",
"node",
"in",
"self",
".",
"graph",
".",
"nodes",
"(",
")",
":",
"score",
"=",
"-",
"1",
"*",
"len",
"(",
"[",
"d",
"for",
"d",
"in",
"nx",
".",
"descendants",
"... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | GraphQueue.get | Get a node off the inner priority queue. By default, this blocks.
This takes the lock, but only for part of it.
:param bool block: If True, block until the inner queue has data
:param Optional[float] timeout: If set, block for timeout seconds
waiting for data.
:return Parse... | core/dbt/linker.py | def get(self, block=True, timeout=None):
"""Get a node off the inner priority queue. By default, this blocks.
This takes the lock, but only for part of it.
:param bool block: If True, block until the inner queue has data
:param Optional[float] timeout: If set, block for timeout seconds... | def get(self, block=True, timeout=None):
"""Get a node off the inner priority queue. By default, this blocks.
This takes the lock, but only for part of it.
:param bool block: If True, block until the inner queue has data
:param Optional[float] timeout: If set, block for timeout seconds... | [
"Get",
"a",
"node",
"off",
"the",
"inner",
"priority",
"queue",
".",
"By",
"default",
"this",
"blocks",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/linker.py#L86-L102 | [
"def",
"get",
"(",
"self",
",",
"block",
"=",
"True",
",",
"timeout",
"=",
"None",
")",
":",
"_",
",",
"node_id",
"=",
"self",
".",
"inner",
".",
"get",
"(",
"block",
"=",
"block",
",",
"timeout",
"=",
"timeout",
")",
"with",
"self",
".",
"lock",... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | GraphQueue._find_new_additions | Find any nodes in the graph that need to be added to the internal
queue and add them.
Callers must hold the lock. | core/dbt/linker.py | def _find_new_additions(self):
"""Find any nodes in the graph that need to be added to the internal
queue and add them.
Callers must hold the lock.
"""
for node, in_degree in self.graph.in_degree_iter():
if not self._already_known(node) and in_degree == 0:
... | def _find_new_additions(self):
"""Find any nodes in the graph that need to be added to the internal
queue and add them.
Callers must hold the lock.
"""
for node, in_degree in self.graph.in_degree_iter():
if not self._already_known(node) and in_degree == 0:
... | [
"Find",
"any",
"nodes",
"in",
"the",
"graph",
"that",
"need",
"to",
"be",
"added",
"to",
"the",
"internal",
"queue",
"and",
"add",
"them",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/linker.py#L133-L142 | [
"def",
"_find_new_additions",
"(",
"self",
")",
":",
"for",
"node",
",",
"in_degree",
"in",
"self",
".",
"graph",
".",
"in_degree_iter",
"(",
")",
":",
"if",
"not",
"self",
".",
"_already_known",
"(",
"node",
")",
"and",
"in_degree",
"==",
"0",
":",
"s... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | GraphQueue.mark_done | Given a node's unique ID, mark it as done.
This method takes the lock.
:param str node_id: The node ID to mark as complete. | core/dbt/linker.py | def mark_done(self, node_id):
"""Given a node's unique ID, mark it as done.
This method takes the lock.
:param str node_id: The node ID to mark as complete.
"""
with self.lock:
self.in_progress.remove(node_id)
self.graph.remove_node(node_id)
... | def mark_done(self, node_id):
"""Given a node's unique ID, mark it as done.
This method takes the lock.
:param str node_id: The node ID to mark as complete.
"""
with self.lock:
self.in_progress.remove(node_id)
self.graph.remove_node(node_id)
... | [
"Given",
"a",
"node",
"s",
"unique",
"ID",
"mark",
"it",
"as",
"done",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/linker.py#L144-L155 | [
"def",
"mark_done",
"(",
"self",
",",
"node_id",
")",
":",
"with",
"self",
".",
"lock",
":",
"self",
".",
"in_progress",
".",
"remove",
"(",
"node_id",
")",
"self",
".",
"graph",
".",
"remove_node",
"(",
"node_id",
")",
"self",
".",
"_find_new_additions"... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | GraphQueue._mark_in_progress | Mark the node as 'in progress'.
Callers must hold the lock.
:param str node_id: The node ID to mark as in progress. | core/dbt/linker.py | def _mark_in_progress(self, node_id):
"""Mark the node as 'in progress'.
Callers must hold the lock.
:param str node_id: The node ID to mark as in progress.
"""
self.queued.remove(node_id)
self.in_progress.add(node_id) | def _mark_in_progress(self, node_id):
"""Mark the node as 'in progress'.
Callers must hold the lock.
:param str node_id: The node ID to mark as in progress.
"""
self.queued.remove(node_id)
self.in_progress.add(node_id) | [
"Mark",
"the",
"node",
"as",
"in",
"progress",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/linker.py#L157-L165 | [
"def",
"_mark_in_progress",
"(",
"self",
",",
"node_id",
")",
":",
"self",
".",
"queued",
".",
"remove",
"(",
"node_id",
")",
"self",
".",
"in_progress",
".",
"add",
"(",
"node_id",
")"
] | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | Linker.as_graph_queue | Returns a queue over nodes in the graph that tracks progress of
dependecies. | core/dbt/linker.py | def as_graph_queue(self, manifest, limit_to=None):
"""Returns a queue over nodes in the graph that tracks progress of
dependecies.
"""
if limit_to is None:
graph_nodes = self.graph.nodes()
else:
graph_nodes = limit_to
new_graph = _subset_graph(sel... | def as_graph_queue(self, manifest, limit_to=None):
"""Returns a queue over nodes in the graph that tracks progress of
dependecies.
"""
if limit_to is None:
graph_nodes = self.graph.nodes()
else:
graph_nodes = limit_to
new_graph = _subset_graph(sel... | [
"Returns",
"a",
"queue",
"over",
"nodes",
"in",
"the",
"graph",
"that",
"tracks",
"progress",
"of",
"dependecies",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/linker.py#L223-L233 | [
"def",
"as_graph_queue",
"(",
"self",
",",
"manifest",
",",
"limit_to",
"=",
"None",
")",
":",
"if",
"limit_to",
"is",
"None",
":",
"graph_nodes",
"=",
"self",
".",
"graph",
".",
"nodes",
"(",
")",
"else",
":",
"graph_nodes",
"=",
"limit_to",
"new_graph"... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | Linker.dependency | indicate that node1 depends on node2 | core/dbt/linker.py | def dependency(self, node1, node2):
"indicate that node1 depends on node2"
self.graph.add_node(node1)
self.graph.add_node(node2)
self.graph.add_edge(node2, node1) | def dependency(self, node1, node2):
"indicate that node1 depends on node2"
self.graph.add_node(node1)
self.graph.add_node(node2)
self.graph.add_edge(node2, node1) | [
"indicate",
"that",
"node1",
"depends",
"on",
"node2"
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/linker.py#L238-L242 | [
"def",
"dependency",
"(",
"self",
",",
"node1",
",",
"node2",
")",
":",
"self",
".",
"graph",
".",
"add_node",
"(",
"node1",
")",
"self",
".",
"graph",
".",
"add_node",
"(",
"node2",
")",
"self",
".",
"graph",
".",
"add_edge",
"(",
"node2",
",",
"n... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | Linker.write_graph | Write the graph to a gpickle file. Before doing so, serialize and
include all nodes in their corresponding graph entries. | core/dbt/linker.py | def write_graph(self, outfile, manifest):
"""Write the graph to a gpickle file. Before doing so, serialize and
include all nodes in their corresponding graph entries.
"""
out_graph = _updated_graph(self.graph, manifest)
nx.write_gpickle(out_graph, outfile) | def write_graph(self, outfile, manifest):
"""Write the graph to a gpickle file. Before doing so, serialize and
include all nodes in their corresponding graph entries.
"""
out_graph = _updated_graph(self.graph, manifest)
nx.write_gpickle(out_graph, outfile) | [
"Write",
"the",
"graph",
"to",
"a",
"gpickle",
"file",
".",
"Before",
"doing",
"so",
"serialize",
"and",
"include",
"all",
"nodes",
"in",
"their",
"corresponding",
"graph",
"entries",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/linker.py#L252-L257 | [
"def",
"write_graph",
"(",
"self",
",",
"outfile",
",",
"manifest",
")",
":",
"out_graph",
"=",
"_updated_graph",
"(",
"self",
".",
"graph",
",",
"manifest",
")",
"nx",
".",
"write_gpickle",
"(",
"out_graph",
",",
"outfile",
")"
] | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | initialize_config_values | Given the parsed args, initialize the dbt tracking code.
It would be nice to re-use this profile later on instead of parsing it
twice, but dbt's intialization is not structured in a way that makes that
easy. | core/dbt/main.py | def initialize_config_values(parsed):
"""Given the parsed args, initialize the dbt tracking code.
It would be nice to re-use this profile later on instead of parsing it
twice, but dbt's intialization is not structured in a way that makes that
easy.
"""
try:
cfg = UserConfig.from_directo... | def initialize_config_values(parsed):
"""Given the parsed args, initialize the dbt tracking code.
It would be nice to re-use this profile later on instead of parsing it
twice, but dbt's intialization is not structured in a way that makes that
easy.
"""
try:
cfg = UserConfig.from_directo... | [
"Given",
"the",
"parsed",
"args",
"initialize",
"the",
"dbt",
"tracking",
"code",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/main.py#L116-L134 | [
"def",
"initialize_config_values",
"(",
"parsed",
")",
":",
"try",
":",
"cfg",
"=",
"UserConfig",
".",
"from_directory",
"(",
"parsed",
".",
"profiles_dir",
")",
"except",
"RuntimeException",
":",
"cfg",
"=",
"UserConfig",
".",
"from_dict",
"(",
"None",
")",
... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | find_matching | Given an absolute `root_path`, a list of relative paths to that
absolute root path (`relative_paths_to_search`), and a `file_pattern`
like '*.sql', returns information about the files. For example:
> find_matching('/root/path', 'models', '*.sql')
[ { 'absolute_path': '/root/path/models/model_one.sql... | core/dbt/clients/system.py | def find_matching(root_path,
relative_paths_to_search,
file_pattern):
"""
Given an absolute `root_path`, a list of relative paths to that
absolute root path (`relative_paths_to_search`), and a `file_pattern`
like '*.sql', returns information about the files. For examp... | def find_matching(root_path,
relative_paths_to_search,
file_pattern):
"""
Given an absolute `root_path`, a list of relative paths to that
absolute root path (`relative_paths_to_search`), and a `file_pattern`
like '*.sql', returns information about the files. For examp... | [
"Given",
"an",
"absolute",
"root_path",
"a",
"list",
"of",
"relative",
"paths",
"to",
"that",
"absolute",
"root",
"path",
"(",
"relative_paths_to_search",
")",
"and",
"a",
"file_pattern",
"like",
"*",
".",
"sql",
"returns",
"information",
"about",
"the",
"file... | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/clients/system.py#L20-L58 | [
"def",
"find_matching",
"(",
"root_path",
",",
"relative_paths_to_search",
",",
"file_pattern",
")",
":",
"matching",
"=",
"[",
"]",
"root_path",
"=",
"os",
".",
"path",
".",
"normpath",
"(",
"root_path",
")",
"for",
"relative_path_to_search",
"in",
"relative_pa... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | make_directory | Make a directory and any intermediate directories that don't already
exist. This function handles the case where two threads try to create
a directory at once. | core/dbt/clients/system.py | def make_directory(path):
"""
Make a directory and any intermediate directories that don't already
exist. This function handles the case where two threads try to create
a directory at once.
"""
if not os.path.exists(path):
# concurrent writes that try to create the same dir can fail
... | def make_directory(path):
"""
Make a directory and any intermediate directories that don't already
exist. This function handles the case where two threads try to create
a directory at once.
"""
if not os.path.exists(path):
# concurrent writes that try to create the same dir can fail
... | [
"Make",
"a",
"directory",
"and",
"any",
"intermediate",
"directories",
"that",
"don",
"t",
"already",
"exist",
".",
"This",
"function",
"handles",
"the",
"case",
"where",
"two",
"threads",
"try",
"to",
"create",
"a",
"directory",
"at",
"once",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/clients/system.py#L71-L86 | [
"def",
"make_directory",
"(",
"path",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"# concurrent writes that try to create the same dir can fail",
"try",
":",
"os",
".",
"makedirs",
"(",
"path",
")",
"except",
"OSError",
"as"... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | make_file | Make a file at `path` assuming that the directory it resides in already
exists. The file is saved with contents `contents` | core/dbt/clients/system.py | def make_file(path, contents='', overwrite=False):
"""
Make a file at `path` assuming that the directory it resides in already
exists. The file is saved with contents `contents`
"""
if overwrite or not os.path.exists(path):
with open(path, 'w') as fh:
fh.write(contents)
r... | def make_file(path, contents='', overwrite=False):
"""
Make a file at `path` assuming that the directory it resides in already
exists. The file is saved with contents `contents`
"""
if overwrite or not os.path.exists(path):
with open(path, 'w') as fh:
fh.write(contents)
r... | [
"Make",
"a",
"file",
"at",
"path",
"assuming",
"that",
"the",
"directory",
"it",
"resides",
"in",
"already",
"exists",
".",
"The",
"file",
"is",
"saved",
"with",
"contents",
"contents"
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/clients/system.py#L89-L99 | [
"def",
"make_file",
"(",
"path",
",",
"contents",
"=",
"''",
",",
"overwrite",
"=",
"False",
")",
":",
"if",
"overwrite",
"or",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"with",
"open",
"(",
"path",
",",
"'w'",
")",
"as",
"f... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | make_symlink | Create a symlink at `link_path` referring to `source`. | core/dbt/clients/system.py | def make_symlink(source, link_path):
"""
Create a symlink at `link_path` referring to `source`.
"""
if not supports_symlinks():
dbt.exceptions.system_error('create a symbolic link')
return os.symlink(source, link_path) | def make_symlink(source, link_path):
"""
Create a symlink at `link_path` referring to `source`.
"""
if not supports_symlinks():
dbt.exceptions.system_error('create a symbolic link')
return os.symlink(source, link_path) | [
"Create",
"a",
"symlink",
"at",
"link_path",
"referring",
"to",
"source",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/clients/system.py#L102-L109 | [
"def",
"make_symlink",
"(",
"source",
",",
"link_path",
")",
":",
"if",
"not",
"supports_symlinks",
"(",
")",
":",
"dbt",
".",
"exceptions",
".",
"system_error",
"(",
"'create a symbolic link'",
")",
"return",
"os",
".",
"symlink",
"(",
"source",
",",
"link_... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | resolve_path_from_base | If path-to_resolve is a relative path, create an absolute path
with base_path as the base.
If path_to_resolve is an absolute path or a user path (~), just
resolve it to an absolute path and return. | core/dbt/clients/system.py | def resolve_path_from_base(path_to_resolve, base_path):
"""
If path-to_resolve is a relative path, create an absolute path
with base_path as the base.
If path_to_resolve is an absolute path or a user path (~), just
resolve it to an absolute path and return.
"""
return os.path.abspath(
... | def resolve_path_from_base(path_to_resolve, base_path):
"""
If path-to_resolve is a relative path, create an absolute path
with base_path as the base.
If path_to_resolve is an absolute path or a user path (~), just
resolve it to an absolute path and return.
"""
return os.path.abspath(
... | [
"If",
"path",
"-",
"to_resolve",
"is",
"a",
"relative",
"path",
"create",
"an",
"absolute",
"path",
"with",
"base_path",
"as",
"the",
"base",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/clients/system.py#L136-L147 | [
"def",
"resolve_path_from_base",
"(",
"path_to_resolve",
",",
"base_path",
")",
":",
"return",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"join",
"(",
"base_path",
",",
"os",
".",
"path",
".",
"expanduser",
"(",
"path_to_resolve",
")",... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | rmdir | Recursively deletes a directory. Includes an error handler to retry with
different permissions on Windows. Otherwise, removing directories (eg.
cloned via git) can cause rmtree to throw a PermissionError exception | core/dbt/clients/system.py | def rmdir(path):
"""
Recursively deletes a directory. Includes an error handler to retry with
different permissions on Windows. Otherwise, removing directories (eg.
cloned via git) can cause rmtree to throw a PermissionError exception
"""
logger.debug("DEBUG** Window rmdir sys.platform: {}".form... | def rmdir(path):
"""
Recursively deletes a directory. Includes an error handler to retry with
different permissions on Windows. Otherwise, removing directories (eg.
cloned via git) can cause rmtree to throw a PermissionError exception
"""
logger.debug("DEBUG** Window rmdir sys.platform: {}".form... | [
"Recursively",
"deletes",
"a",
"directory",
".",
"Includes",
"an",
"error",
"handler",
"to",
"retry",
"with",
"different",
"permissions",
"on",
"Windows",
".",
"Otherwise",
"removing",
"directories",
"(",
"eg",
".",
"cloned",
"via",
"git",
")",
"can",
"cause",... | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/clients/system.py#L150-L162 | [
"def",
"rmdir",
"(",
"path",
")",
":",
"logger",
".",
"debug",
"(",
"\"DEBUG** Window rmdir sys.platform: {}\"",
".",
"format",
"(",
"sys",
".",
"platform",
")",
")",
"if",
"sys",
".",
"platform",
"==",
"'win32'",
":",
"onerror",
"=",
"_windows_rmdir_readonly"... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | _handle_posix_error | OSError handling for posix systems.
Some things that could happen to trigger an OSError:
- cwd could not exist
- exc.errno == ENOENT
- exc.filename == cwd
- cwd could have permissions that prevent the current user moving to it
- exc.errno == EACCES
- ... | core/dbt/clients/system.py | def _handle_posix_error(exc, cwd, cmd):
"""OSError handling for posix systems.
Some things that could happen to trigger an OSError:
- cwd could not exist
- exc.errno == ENOENT
- exc.filename == cwd
- cwd could have permissions that prevent the current user moving to it
... | def _handle_posix_error(exc, cwd, cmd):
"""OSError handling for posix systems.
Some things that could happen to trigger an OSError:
- cwd could not exist
- exc.errno == ENOENT
- exc.filename == cwd
- cwd could have permissions that prevent the current user moving to it
... | [
"OSError",
"handling",
"for",
"posix",
"systems",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/clients/system.py#L211-L235 | [
"def",
"_handle_posix_error",
"(",
"exc",
",",
"cwd",
",",
"cmd",
")",
":",
"if",
"getattr",
"(",
"exc",
",",
"'filename'",
",",
"None",
")",
"==",
"cwd",
":",
"_handle_posix_cwd_error",
"(",
"exc",
",",
"cwd",
",",
"cmd",
")",
"else",
":",
"_handle_po... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | _interpret_oserror | Interpret an OSError exc and raise the appropriate dbt exception. | core/dbt/clients/system.py | def _interpret_oserror(exc, cwd, cmd):
"""Interpret an OSError exc and raise the appropriate dbt exception.
"""
if len(cmd) == 0:
raise dbt.exceptions.CommandError(cwd, cmd)
# all of these functions raise unconditionally
if os.name == 'nt':
_handle_windows_error(exc, cwd, cmd)
... | def _interpret_oserror(exc, cwd, cmd):
"""Interpret an OSError exc and raise the appropriate dbt exception.
"""
if len(cmd) == 0:
raise dbt.exceptions.CommandError(cwd, cmd)
# all of these functions raise unconditionally
if os.name == 'nt':
_handle_windows_error(exc, cwd, cmd)
... | [
"Interpret",
"an",
"OSError",
"exc",
"and",
"raise",
"the",
"appropriate",
"dbt",
"exception",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/clients/system.py#L258-L274 | [
"def",
"_interpret_oserror",
"(",
"exc",
",",
"cwd",
",",
"cmd",
")",
":",
"if",
"len",
"(",
"cmd",
")",
"==",
"0",
":",
"raise",
"dbt",
".",
"exceptions",
".",
"CommandError",
"(",
"cwd",
",",
"cmd",
")",
"# all of these functions raise unconditionally",
... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | chmod_and_retry | Define an error handler to pass to shutil.rmtree.
On Windows, when a file is marked read-only as git likes to do, rmtree will
fail. To handle that, on errors try to make the file writable.
We want to retry most operations here, but listdir is one that we know will
be useless. | core/dbt/clients/system.py | def chmod_and_retry(func, path, exc_info):
"""Define an error handler to pass to shutil.rmtree.
On Windows, when a file is marked read-only as git likes to do, rmtree will
fail. To handle that, on errors try to make the file writable.
We want to retry most operations here, but listdir is one that we kno... | def chmod_and_retry(func, path, exc_info):
"""Define an error handler to pass to shutil.rmtree.
On Windows, when a file is marked read-only as git likes to do, rmtree will
fail. To handle that, on errors try to make the file writable.
We want to retry most operations here, but listdir is one that we kno... | [
"Define",
"an",
"error",
"handler",
"to",
"pass",
"to",
"shutil",
".",
"rmtree",
".",
"On",
"Windows",
"when",
"a",
"file",
"is",
"marked",
"read",
"-",
"only",
"as",
"git",
"likes",
"to",
"do",
"rmtree",
"will",
"fail",
".",
"To",
"handle",
"that",
... | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/clients/system.py#L342-L353 | [
"def",
"chmod_and_retry",
"(",
"func",
",",
"path",
",",
"exc_info",
")",
":",
"if",
"func",
"is",
"os",
".",
"listdir",
"or",
"os",
".",
"name",
"!=",
"'nt'",
":",
"raise",
"os",
".",
"chmod",
"(",
"path",
",",
"stat",
".",
"S_IREAD",
"|",
"stat",... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | move | A re-implementation of shutil.move that properly removes the source
directory on windows when it has read-only files in it and the move is
between two drives.
This is almost identical to the real shutil.move, except it uses our rmtree
and skips handling non-windows OSes since the existing one works ok ... | core/dbt/clients/system.py | def move(src, dst):
"""A re-implementation of shutil.move that properly removes the source
directory on windows when it has read-only files in it and the move is
between two drives.
This is almost identical to the real shutil.move, except it uses our rmtree
and skips handling non-windows OSes since... | def move(src, dst):
"""A re-implementation of shutil.move that properly removes the source
directory on windows when it has read-only files in it and the move is
between two drives.
This is almost identical to the real shutil.move, except it uses our rmtree
and skips handling non-windows OSes since... | [
"A",
"re",
"-",
"implementation",
"of",
"shutil",
".",
"move",
"that",
"properly",
"removes",
"the",
"source",
"directory",
"on",
"windows",
"when",
"it",
"has",
"read",
"-",
"only",
"files",
"in",
"it",
"and",
"the",
"move",
"is",
"between",
"two",
"dri... | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/clients/system.py#L360-L395 | [
"def",
"move",
"(",
"src",
",",
"dst",
")",
":",
"if",
"os",
".",
"name",
"!=",
"'nt'",
":",
"return",
"shutil",
".",
"move",
"(",
"src",
",",
"dst",
")",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"dst",
")",
":",
"if",
"_absnorm",
"(",
"sr... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | Credentials.connection_info | Return an ordered iterator of key/value pairs for pretty-printing. | core/dbt/adapters/base/connections.py | def connection_info(self):
"""Return an ordered iterator of key/value pairs for pretty-printing.
"""
for key in self._connection_keys():
if key in self._contents:
yield key, self._contents[key] | def connection_info(self):
"""Return an ordered iterator of key/value pairs for pretty-printing.
"""
for key in self._connection_keys():
if key in self._contents:
yield key, self._contents[key] | [
"Return",
"an",
"ordered",
"iterator",
"of",
"key",
"/",
"value",
"pairs",
"for",
"pretty",
"-",
"printing",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/adapters/base/connections.py#L32-L37 | [
"def",
"connection_info",
"(",
"self",
")",
":",
"for",
"key",
"in",
"self",
".",
"_connection_keys",
"(",
")",
":",
"if",
"key",
"in",
"self",
".",
"_contents",
":",
"yield",
"key",
",",
"self",
".",
"_contents",
"[",
"key",
"]"
] | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | _catalog_filter_schemas | Return a function that takes a row and decides if the row should be
included in the catalog output. | core/dbt/adapters/base/impl.py | def _catalog_filter_schemas(manifest):
"""Return a function that takes a row and decides if the row should be
included in the catalog output.
"""
schemas = frozenset((d.lower(), s.lower())
for d, s in manifest.get_used_schemas())
def test(row):
table_database = _expe... | def _catalog_filter_schemas(manifest):
"""Return a function that takes a row and decides if the row should be
included in the catalog output.
"""
schemas = frozenset((d.lower(), s.lower())
for d, s in manifest.get_used_schemas())
def test(row):
table_database = _expe... | [
"Return",
"a",
"function",
"that",
"takes",
"a",
"row",
"and",
"decides",
"if",
"the",
"row",
"should",
"be",
"included",
"in",
"the",
"catalog",
"output",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/adapters/base/impl.py#L50-L65 | [
"def",
"_catalog_filter_schemas",
"(",
"manifest",
")",
":",
"schemas",
"=",
"frozenset",
"(",
"(",
"d",
".",
"lower",
"(",
")",
",",
"s",
".",
"lower",
"(",
")",
")",
"for",
"d",
",",
"s",
"in",
"manifest",
".",
"get_used_schemas",
"(",
")",
")",
... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | _utc | If dt has a timezone, return a new datetime that's in UTC. Otherwise,
assume the datetime is already for UTC and add the timezone. | core/dbt/adapters/base/impl.py | def _utc(dt, source, field_name):
"""If dt has a timezone, return a new datetime that's in UTC. Otherwise,
assume the datetime is already for UTC and add the timezone.
"""
if dt is None:
raise dbt.exceptions.raise_database_error(
"Expected a non-null value when querying field '{}' of... | def _utc(dt, source, field_name):
"""If dt has a timezone, return a new datetime that's in UTC. Otherwise,
assume the datetime is already for UTC and add the timezone.
"""
if dt is None:
raise dbt.exceptions.raise_database_error(
"Expected a non-null value when querying field '{}' of... | [
"If",
"dt",
"has",
"a",
"timezone",
"return",
"a",
"new",
"datetime",
"that",
"s",
"in",
"UTC",
".",
"Otherwise",
"assume",
"the",
"datetime",
"is",
"already",
"for",
"UTC",
"and",
"add",
"the",
"timezone",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/adapters/base/impl.py#L68-L90 | [
"def",
"_utc",
"(",
"dt",
",",
"source",
",",
"field_name",
")",
":",
"if",
"dt",
"is",
"None",
":",
"raise",
"dbt",
".",
"exceptions",
".",
"raise_database_error",
"(",
"\"Expected a non-null value when querying field '{}' of table \"",
"\" {} but received value 'null'... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | MacroFuzzEnvironment._compile | Override jinja's compilation to stash the rendered source inside
the python linecache for debugging. | core/dbt/clients/jinja.py | def _compile(self, source, filename):
"""Override jinja's compilation to stash the rendered source inside
the python linecache for debugging.
"""
if filename == '<template>':
# make a better filename
filename = 'dbt-{}'.format(
codecs.encode(os.ura... | def _compile(self, source, filename):
"""Override jinja's compilation to stash the rendered source inside
the python linecache for debugging.
"""
if filename == '<template>':
# make a better filename
filename = 'dbt-{}'.format(
codecs.encode(os.ura... | [
"Override",
"jinja",
"s",
"compilation",
"to",
"stash",
"the",
"rendered",
"source",
"inside",
"the",
"python",
"linecache",
"for",
"debugging",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/clients/jinja.py#L44-L63 | [
"def",
"_compile",
"(",
"self",
",",
"source",
",",
"filename",
")",
":",
"if",
"filename",
"==",
"'<template>'",
":",
"# make a better filename",
"filename",
"=",
"'dbt-{}'",
".",
"format",
"(",
"codecs",
".",
"encode",
"(",
"os",
".",
"urandom",
"(",
"12... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | APIObject.validate | Using the SCHEMA property, validate the attributes
of this instance. If any attributes are missing or
invalid, raise a ValidationException. | core/dbt/api/object.py | def validate(self):
"""
Using the SCHEMA property, validate the attributes
of this instance. If any attributes are missing or
invalid, raise a ValidationException.
"""
validator = Draft7Validator(self.SCHEMA)
errors = set() # make errors a set to avoid duplicate... | def validate(self):
"""
Using the SCHEMA property, validate the attributes
of this instance. If any attributes are missing or
invalid, raise a ValidationException.
"""
validator = Draft7Validator(self.SCHEMA)
errors = set() # make errors a set to avoid duplicate... | [
"Using",
"the",
"SCHEMA",
"property",
"validate",
"the",
"attributes",
"of",
"this",
"instance",
".",
"If",
"any",
"attributes",
"are",
"missing",
"or",
"invalid",
"raise",
"a",
"ValidationException",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/api/object.py#L76-L92 | [
"def",
"validate",
"(",
"self",
")",
":",
"validator",
"=",
"Draft7Validator",
"(",
"self",
".",
"SCHEMA",
")",
"errors",
"=",
"set",
"(",
")",
"# make errors a set to avoid duplicates",
"for",
"error",
"in",
"validator",
".",
"iter_errors",
"(",
"self",
".",
... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | BaseRunner._safe_release_connection | Try to release a connection. If an exception is hit, log and return
the error string. | core/dbt/node_runners.py | def _safe_release_connection(self):
"""Try to release a connection. If an exception is hit, log and return
the error string.
"""
try:
self.adapter.release_connection()
except Exception as exc:
logger.debug(
'Error releasing connection for n... | def _safe_release_connection(self):
"""Try to release a connection. If an exception is hit, log and return
the error string.
"""
try:
self.adapter.release_connection()
except Exception as exc:
logger.debug(
'Error releasing connection for n... | [
"Try",
"to",
"release",
"a",
"connection",
".",
"If",
"an",
"exception",
"is",
"hit",
"log",
"and",
"return",
"the",
"error",
"string",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/node_runners.py#L213-L226 | [
"def",
"_safe_release_connection",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"adapter",
".",
"release_connection",
"(",
")",
"except",
"Exception",
"as",
"exc",
":",
"logger",
".",
"debug",
"(",
"'Error releasing connection for node {}: {!s}\\n{}'",
".",
"fo... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | FreshnessRunner._calculate_status | Calculate the status of a run.
:param dict target_freshness: The target freshness dictionary. It must
match the freshness spec.
:param timedelta freshness: The actual freshness of the data, as
calculated from the database's timestamps | core/dbt/node_runners.py | def _calculate_status(self, target_freshness, freshness):
"""Calculate the status of a run.
:param dict target_freshness: The target freshness dictionary. It must
match the freshness spec.
:param timedelta freshness: The actual freshness of the data, as
calculated from t... | def _calculate_status(self, target_freshness, freshness):
"""Calculate the status of a run.
:param dict target_freshness: The target freshness dictionary. It must
match the freshness spec.
:param timedelta freshness: The actual freshness of the data, as
calculated from t... | [
"Calculate",
"the",
"status",
"of",
"a",
"run",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/node_runners.py#L370-L390 | [
"def",
"_calculate_status",
"(",
"self",
",",
"target_freshness",
",",
"freshness",
")",
":",
"# if freshness > warn_after > error_after, you'll get an error, not a",
"# warning",
"for",
"key",
"in",
"(",
"'error'",
",",
"'warn'",
")",
":",
"fullkey",
"=",
"'{}_after'",... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | RuntimeConfig.from_parts | Instantiate a RuntimeConfig from its components.
:param profile Profile: A parsed dbt Profile.
:param project Project: A parsed dbt Project.
:param args argparse.Namespace: The parsed command-line arguments.
:returns RuntimeConfig: The new configuration. | core/dbt/config/runtime.py | def from_parts(cls, project, profile, args):
"""Instantiate a RuntimeConfig from its components.
:param profile Profile: A parsed dbt Profile.
:param project Project: A parsed dbt Project.
:param args argparse.Namespace: The parsed command-line arguments.
:returns RuntimeConfig:... | def from_parts(cls, project, profile, args):
"""Instantiate a RuntimeConfig from its components.
:param profile Profile: A parsed dbt Profile.
:param project Project: A parsed dbt Project.
:param args argparse.Namespace: The parsed command-line arguments.
:returns RuntimeConfig:... | [
"Instantiate",
"a",
"RuntimeConfig",
"from",
"its",
"components",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/config/runtime.py#L67-L109 | [
"def",
"from_parts",
"(",
"cls",
",",
"project",
",",
"profile",
",",
"args",
")",
":",
"quoting",
"=",
"deepcopy",
"(",
"get_relation_class_by_name",
"(",
"profile",
".",
"credentials",
".",
"type",
")",
".",
"DEFAULTS",
"[",
"'quote_policy'",
"]",
")",
"... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | RuntimeConfig.new_project | Given a new project root, read in its project dictionary, supply the
existing project's profile info, and create a new project file.
:param project_root str: A filepath to a dbt project.
:raises DbtProfileError: If the profile is invalid.
:raises DbtProjectError: If project is missing o... | core/dbt/config/runtime.py | def new_project(self, project_root):
"""Given a new project root, read in its project dictionary, supply the
existing project's profile info, and create a new project file.
:param project_root str: A filepath to a dbt project.
:raises DbtProfileError: If the profile is invalid.
... | def new_project(self, project_root):
"""Given a new project root, read in its project dictionary, supply the
existing project's profile info, and create a new project file.
:param project_root str: A filepath to a dbt project.
:raises DbtProfileError: If the profile is invalid.
... | [
"Given",
"a",
"new",
"project",
"root",
"read",
"in",
"its",
"project",
"dictionary",
"supply",
"the",
"existing",
"project",
"s",
"profile",
"info",
"and",
"create",
"a",
"new",
"project",
"file",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/config/runtime.py#L111-L133 | [
"def",
"new_project",
"(",
"self",
",",
"project_root",
")",
":",
"# copy profile",
"profile",
"=",
"Profile",
"(",
"*",
"*",
"self",
".",
"to_profile_info",
"(",
")",
")",
"profile",
".",
"validate",
"(",
")",
"# load the new project and its packages. Don't pass ... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | RuntimeConfig.serialize | Serialize the full configuration to a single dictionary. For any
instance that has passed validate() (which happens in __init__), it
matches the Configuration contract.
Note that args are not serialized.
:returns dict: The serialized configuration. | core/dbt/config/runtime.py | def serialize(self):
"""Serialize the full configuration to a single dictionary. For any
instance that has passed validate() (which happens in __init__), it
matches the Configuration contract.
Note that args are not serialized.
:returns dict: The serialized configuration.
... | def serialize(self):
"""Serialize the full configuration to a single dictionary. For any
instance that has passed validate() (which happens in __init__), it
matches the Configuration contract.
Note that args are not serialized.
:returns dict: The serialized configuration.
... | [
"Serialize",
"the",
"full",
"configuration",
"to",
"a",
"single",
"dictionary",
".",
"For",
"any",
"instance",
"that",
"has",
"passed",
"validate",
"()",
"(",
"which",
"happens",
"in",
"__init__",
")",
"it",
"matches",
"the",
"Configuration",
"contract",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/config/runtime.py#L135-L147 | [
"def",
"serialize",
"(",
"self",
")",
":",
"result",
"=",
"self",
".",
"to_project_config",
"(",
"with_packages",
"=",
"True",
")",
"result",
".",
"update",
"(",
"self",
".",
"to_profile_info",
"(",
"serialize_credentials",
"=",
"True",
")",
")",
"result",
... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | RuntimeConfig.validate | Validate the configuration against its contract.
:raises DbtProjectError: If the configuration fails validation. | core/dbt/config/runtime.py | def validate(self):
"""Validate the configuration against its contract.
:raises DbtProjectError: If the configuration fails validation.
"""
try:
Configuration(**self.serialize())
except ValidationException as e:
raise DbtProjectError(str(e))
if g... | def validate(self):
"""Validate the configuration against its contract.
:raises DbtProjectError: If the configuration fails validation.
"""
try:
Configuration(**self.serialize())
except ValidationException as e:
raise DbtProjectError(str(e))
if g... | [
"Validate",
"the",
"configuration",
"against",
"its",
"contract",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/config/runtime.py#L152-L163 | [
"def",
"validate",
"(",
"self",
")",
":",
"try",
":",
"Configuration",
"(",
"*",
"*",
"self",
".",
"serialize",
"(",
")",
")",
"except",
"ValidationException",
"as",
"e",
":",
"raise",
"DbtProjectError",
"(",
"str",
"(",
"e",
")",
")",
"if",
"getattr",... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | RuntimeConfig.from_args | Given arguments, read in dbt_project.yml from the current directory,
read in packages.yml if it exists, and use them to find the profile to
load.
:param args argparse.Namespace: The arguments as parsed from the cli.
:raises DbtProjectError: If the project is invalid or missing.
... | core/dbt/config/runtime.py | def from_args(cls, args):
"""Given arguments, read in dbt_project.yml from the current directory,
read in packages.yml if it exists, and use them to find the profile to
load.
:param args argparse.Namespace: The arguments as parsed from the cli.
:raises DbtProjectError: If the pr... | def from_args(cls, args):
"""Given arguments, read in dbt_project.yml from the current directory,
read in packages.yml if it exists, and use them to find the profile to
load.
:param args argparse.Namespace: The arguments as parsed from the cli.
:raises DbtProjectError: If the pr... | [
"Given",
"arguments",
"read",
"in",
"dbt_project",
".",
"yml",
"from",
"the",
"current",
"directory",
"read",
"in",
"packages",
".",
"yml",
"if",
"it",
"exists",
"and",
"use",
"them",
"to",
"find",
"the",
"profile",
"to",
"load",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/config/runtime.py#L166-L189 | [
"def",
"from_args",
"(",
"cls",
",",
"args",
")",
":",
"# build the project and read in packages.yml",
"project",
"=",
"Project",
".",
"from_args",
"(",
"args",
")",
"# build the profile",
"profile",
"=",
"Profile",
".",
"from_args",
"(",
"args",
"=",
"args",
",... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | _node_is_match | Determine if a qualfied name matches an fqn, given the set of package
names in the graph.
:param List[str] qualified_name: The components of the selector or node
name, split on '.'.
:param Set[str] package_names: The set of pacakge names in the graph.
:param List[str] fqn: The node's fully qual... | core/dbt/graph/selector.py | def _node_is_match(qualified_name, package_names, fqn):
"""Determine if a qualfied name matches an fqn, given the set of package
names in the graph.
:param List[str] qualified_name: The components of the selector or node
name, split on '.'.
:param Set[str] package_names: The set of pacakge name... | def _node_is_match(qualified_name, package_names, fqn):
"""Determine if a qualfied name matches an fqn, given the set of package
names in the graph.
:param List[str] qualified_name: The components of the selector or node
name, split on '.'.
:param Set[str] package_names: The set of pacakge name... | [
"Determine",
"if",
"a",
"qualfied",
"name",
"matches",
"an",
"fqn",
"given",
"the",
"set",
"of",
"package",
"names",
"in",
"the",
"graph",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/graph/selector.py#L93-L114 | [
"def",
"_node_is_match",
"(",
"qualified_name",
",",
"package_names",
",",
"fqn",
")",
":",
"if",
"len",
"(",
"qualified_name",
")",
"==",
"1",
"and",
"fqn",
"[",
"-",
"1",
"]",
"==",
"qualified_name",
"[",
"0",
"]",
":",
"return",
"True",
"if",
"quali... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | NodeSelector.get_nodes_by_qualified_name | Yield all nodes in the graph that match the qualified_name_selector.
:param str qualified_name_selector: The selector or node name | core/dbt/graph/selector.py | def get_nodes_by_qualified_name(self, graph, qualified_name_selector):
"""Yield all nodes in the graph that match the qualified_name_selector.
:param str qualified_name_selector: The selector or node name
"""
qualified_name = qualified_name_selector.split(".")
package_names = ge... | def get_nodes_by_qualified_name(self, graph, qualified_name_selector):
"""Yield all nodes in the graph that match the qualified_name_selector.
:param str qualified_name_selector: The selector or node name
"""
qualified_name = qualified_name_selector.split(".")
package_names = ge... | [
"Yield",
"all",
"nodes",
"in",
"the",
"graph",
"that",
"match",
"the",
"qualified_name_selector",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/graph/selector.py#L154-L163 | [
"def",
"get_nodes_by_qualified_name",
"(",
"self",
",",
"graph",
",",
"qualified_name_selector",
")",
":",
"qualified_name",
"=",
"qualified_name_selector",
".",
"split",
"(",
"\".\"",
")",
"package_names",
"=",
"get_package_names",
"(",
"graph",
")",
"for",
"node",... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | NodeSelector.get_nodes_by_tag | yields nodes from graph that have the specified tag | core/dbt/graph/selector.py | def get_nodes_by_tag(self, graph, tag_name):
""" yields nodes from graph that have the specified tag """
for node, real_node in self.parsed_nodes(graph):
if tag_name in real_node.tags:
yield node | def get_nodes_by_tag(self, graph, tag_name):
""" yields nodes from graph that have the specified tag """
for node, real_node in self.parsed_nodes(graph):
if tag_name in real_node.tags:
yield node | [
"yields",
"nodes",
"from",
"graph",
"that",
"have",
"the",
"specified",
"tag"
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/graph/selector.py#L165-L169 | [
"def",
"get_nodes_by_tag",
"(",
"self",
",",
"graph",
",",
"tag_name",
")",
":",
"for",
"node",
",",
"real_node",
"in",
"self",
".",
"parsed_nodes",
"(",
"graph",
")",
":",
"if",
"tag_name",
"in",
"real_node",
".",
"tags",
":",
"yield",
"node"
] | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
train | NodeSelector.get_nodes_by_source | yields nodes from graph are the specified source. | core/dbt/graph/selector.py | def get_nodes_by_source(self, graph, source_full_name):
"""yields nodes from graph are the specified source."""
parts = source_full_name.split('.')
if len(parts) == 1:
target_source, target_table = parts[0], None
elif len(parts) == 2:
target_source, target_table =... | def get_nodes_by_source(self, graph, source_full_name):
"""yields nodes from graph are the specified source."""
parts = source_full_name.split('.')
if len(parts) == 1:
target_source, target_table = parts[0], None
elif len(parts) == 2:
target_source, target_table =... | [
"yields",
"nodes",
"from",
"graph",
"are",
"the",
"specified",
"source",
"."
] | fishtown-analytics/dbt | python | https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/graph/selector.py#L171-L190 | [
"def",
"get_nodes_by_source",
"(",
"self",
",",
"graph",
",",
"source_full_name",
")",
":",
"parts",
"=",
"source_full_name",
".",
"split",
"(",
"'.'",
")",
"if",
"len",
"(",
"parts",
")",
"==",
"1",
":",
"target_source",
",",
"target_table",
"=",
"parts",... | aa4f771df28b307af0cf9fe2fc24432f10a8236b |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.