Best Python code snippet using dbt-osmosis_python
impl.py
Source:impl.py  
...93            'relation': relation,94            'column_name': column_name,95            'new_column_type': new_column_type,96        }97        self.execute_macro(98            ALTER_COLUMN_TYPE_MACRO_NAME,99            kwargs=kwargs100        )101    def drop_relation(self, relation):102        if dbt.flags.USE_CACHE:103            self.cache.drop(relation)104        if relation.type is None:105            dbt.exceptions.raise_compiler_error(106                'Tried to drop relation {}, but its type is null.'107                .format(relation))108        self.execute_macro(109            DROP_RELATION_MACRO_NAME,110            kwargs={'relation': relation}111        )112    def truncate_relation(self, relation):113        self.execute_macro(114            TRUNCATE_RELATION_MACRO_NAME,115            kwargs={'relation': relation}116        )117    def rename_relation(self, from_relation, to_relation):118        if dbt.flags.USE_CACHE:119            self.cache.rename(from_relation, to_relation)120        kwargs = {'from_relation': from_relation, 'to_relation': to_relation}121        self.execute_macro(122            RENAME_RELATION_MACRO_NAME,123            kwargs=kwargs124        )125    def get_columns_in_relation(self, relation):126        return self.execute_macro(127            GET_COLUMNS_IN_RELATION_MACRO_NAME,128            kwargs={'relation': relation}129        )130    def create_schema(self, database, schema):131        logger.debug('Creating schema "%s"."%s".', database, schema)132        kwargs = {133            'database_name': self.quote_as_configured(database, 'database'),134            'schema_name': self.quote_as_configured(schema, 'schema'),135        }136        self.execute_macro(CREATE_SCHEMA_MACRO_NAME, kwargs=kwargs)137        self.commit_if_has_connection()138    def drop_schema(self, database, schema):139        logger.debug('Dropping schema "%s"."%s".', database, schema)140        kwargs = {141            'database_name': self.quote_as_configured(database, 'database'),142            'schema_name': self.quote_as_configured(schema, 'schema'),143        }144        self.execute_macro(DROP_SCHEMA_MACRO_NAME,145                           kwargs=kwargs)146    def list_relations_without_caching(self, information_schema, schema):147        kwargs = {'information_schema': information_schema, 'schema': schema}148        results = self.execute_macro(149            LIST_RELATIONS_MACRO_NAME,150            kwargs=kwargs151        )152        relations = []153        quote_policy = {154            'database': True,155            'schema': True,156            'identifier': True157        }158        for _database, name, _schema, _type in results:159            relations.append(self.Relation.create(160                database=_database,161                schema=_schema,162                identifier=name,163                quote_policy=quote_policy,164                type=_type165            ))166        return relations167    def quote(cls, identifier):168        return '"{}"'.format(identifier)169    def list_schemas(self, database):170        results = self.execute_macro(171            LIST_SCHEMAS_MACRO_NAME,172            kwargs={'database': database}173        )174        return [row[0] for row in results]175    def check_schema_exists(self, database, schema):176        information_schema = self.Relation.create(177            database=database, schema=schema,178            quote_policy=self.config.quoting179        ).information_schema()180        kwargs = {'information_schema': information_schema, 'schema': schema}181        results = self.execute_macro(182            CHECK_SCHEMA_EXISTS_MACRO_NAME,183            kwargs=kwargs184        )...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
