def information_schema(self, identifier=None): include_db = self.database is not None include_policy = filter_null_values({ 'database': include_db, 'schema': True, 'identifier': identifier is not None }) quote_policy = filter_null_values({ 'database': self.quote_policy['database'], 'schema': False, 'identifier': False, }) path_update = { 'schema': 'information_schema', 'identifier': identifier } return self.incorporate(quote_policy=quote_policy, include_policy=include_policy, path=path_update, table_name=identifier)
def matches( self, database: Optional[str] = None, schema: Optional[str] = None, identifier: Optional[str] = None, ) -> bool: search = filter_null_values({ ComponentName.Database: database, ComponentName.Schema: schema, ComponentName.Identifier: identifier }) if not search: # nothing was passed in raise dbt.exceptions.RuntimeException( "Tried to match relation, but no search path was passed!") exact_match = True approximate_match = True for k, v in search.items(): if not self._is_exactish_match(k, v): exact_match = False if self.path.get_lowered_part(k) != v.lower(): approximate_match = False if approximate_match and not exact_match: target = self.create(database=database, schema=schema, identifier=identifier) dbt.exceptions.approximate_relation_match(target, self) return exact_match
def _make_match_kwargs(self, database: str, schema: str, identifier: str) -> Dict[str, str]: return filter_null_values({ 'database': database, 'identifier': identifier, 'schema': schema, })
def matches(self, database=None, schema=None, identifier=None): search = filter_null_values({ 'database': database, 'schema': schema, 'identifier': identifier }) if not search: # nothing was passed in raise dbt.exceptions.RuntimeException( "Tried to match relation, but no search path was passed!") exact_match = True approximate_match = True for k, v in search.items(): if self.get_path_part(k) != v: exact_match = False if self.get_path_part(k).lower() != v.lower(): approximate_match = False if approximate_match and not exact_match: target = self.create( database=database, schema=schema, identifier=identifier) dbt.exceptions.approximate_relation_match(target, self) return exact_match
def matches(self, database=None, schema=None, identifier=None): search = filter_null_values({ 'database': database, 'schema': schema, 'identifier': identifier }) if not search: # nothing was passed in raise dbt.exceptions.RuntimeException( "Tried to match relation, but no search path was passed!") exact_match = True approximate_match = True for k, v in search.items(): if self.get_path_part(k) != v: exact_match = False if self.get_path_part(k).lower() != v.lower(): approximate_match = False if approximate_match and not exact_match: target = self.create(database=database, schema=schema, identifier=identifier) dbt.exceptions.approximate_relation_match(target, self) return exact_match
def include(self, project=None, schema=None, identifier=None): policy = filter_null_values({ 'project': project, 'schema': schema, 'identifier': identifier }) return self.incorporate(include_policy=policy)
def quote(self, database=None, schema=None, identifier=None): policy = filter_null_values({ 'database': database, 'schema': schema, 'identifier': identifier }) return self.incorporate(quote_policy=policy)
def include(self, database=None, schema=None, identifier=None): policy = filter_null_values({ 'database': database, 'schema': schema, 'identifier': identifier }) return self.incorporate(include_policy=policy)
def _make_match_kwargs(self, schema, identifier): quoting = self.config.quoting if identifier is not None and quoting['identifier'] is False: identifier = identifier.lower() if schema is not None and quoting['schema'] is False: schema = schema.lower() return filter_null_values({'identifier': identifier, 'schema': schema})
def _make_match_kwargs(cls, project_cfg, schema, identifier): if identifier is not None and \ project_cfg.get('quoting', {}).get('identifier') is False: identifier = identifier.lower() if schema is not None and \ project_cfg.get('quoting', {}).get('schema') is False: schema = schema.lower() return filter_null_values({'identifier': identifier, 'schema': schema})
def include( self: Self, database: Optional[bool] = None, schema: Optional[bool] = None, identifier: Optional[bool] = None, ) -> Self: policy = filter_null_values({ ComponentName.Database: database, ComponentName.Schema: schema, ComponentName.Identifier: identifier }) new_include_policy = self.include_policy.replace_dict(policy) return self.replace(include_policy=new_include_policy)
def information_schema(self, identifier=None): include_db = self.database is not None include_policy = filter_null_values({ 'database': include_db, 'schema': True, 'identifier': identifier is not None }) quote_policy = filter_null_values({ 'database': self.quote_policy['database'], 'schema': False, 'identifier': False, }) path_update = { 'schema': 'information_schema', 'identifier': identifier } return self.incorporate( quote_policy=quote_policy, include_policy=include_policy, path=path_update, table_name=identifier)
def _make_match_kwargs(self, database, schema, identifier): quoting = self.config.quoting if identifier is not None and quoting["identifier"] is False: identifier = identifier.upper() if schema is not None and quoting["schema"] is False: schema = schema.upper() if database is not None and quoting["database"] is False: database = database.upper() return filter_null_values( {"identifier": identifier, "schema": schema, "database": database} )
def _make_match_kwargs(self, database: str, schema: str, identifier: str) -> Dict[str, str]: quoting = self.config.quoting if identifier is not None and quoting['identifier'] is False: identifier = identifier.lower() if schema is not None and quoting['schema'] is False: schema = schema.lower() if database is not None and quoting['database'] is False: database = database.lower() return filter_null_values({ 'identifier': identifier, 'schema': schema, })
def _make_match_kwargs(self, database, schema, identifier): quoting = self.config.quoting if identifier is not None and quoting['identifier'] is False: identifier = identifier.lower() if schema is not None and quoting['schema'] is False: schema = schema.lower() if database is not None and quoting['schema'] is False: database = database.lower() return filter_null_values({ 'database': database, 'identifier': identifier, 'schema': schema, })
def _make_match_kwargs(self, database, schema, identifier): quoting = self.config.quoting if identifier is not None and quoting['identifier'] is False: identifier = identifier.upper() if schema is not None and quoting['schema'] is False: schema = schema.upper() if database is not None and quoting['database'] is False: database = database.upper() return filter_null_values({ 'identifier': identifier, 'schema': schema, 'database': database })
def matches(self, project=None, schema=None, identifier=None): search = filter_null_values({ 'project': project, 'schema': schema, 'identifier': identifier }) if not search: # nothing was passed in pass for k, v in search.items(): if self.get_path_part(k) != v: return False return True
def matches(self, database=None, schema=None, identifier=None): search = filter_null_values({ 'database': database, 'schema': schema, 'identifier': identifier }) if not search: # nothing was passed in pass for k, v in search.items(): if not self._is_exactish_match(k, v): return False return True
def matches(self, database=None, schema=None, identifier=None): search = filter_null_values({ 'database': database, 'schema': schema, 'identifier': identifier }) if not search: # nothing was passed in pass for k, v in search.items(): if self.get_path_part(k) != v: return False return True
def matches( self, database: Optional[str] = None, schema: Optional[str] = None, identifier: Optional[str] = None, ) -> bool: search = filter_null_values({ ComponentName.Database: database, ComponentName.Schema: schema, ComponentName.Identifier: identifier }) if not search: # nothing was passed in pass for k, v in search.items(): if not self._is_exactish_match(k, v): return False return True