How to use the m3d.util.hql_generator.HQLGenerator.Statement function in m3d

To help you get started, we’ve selected a few m3d examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github adidas / m3d-api / m3d / util / hql_generator.py View on Github external
return "PARTITION({})".format(", ".join(target_partitions))
            else:
                return ""

        def make_insert_str():
            return "INSERT INTO TABLE {}".format(target_table)

        hql_statement = """
            {insert_str} {partition_str}
            {select_str}
        """.format(
            insert_str=make_insert_str(),
            partition_str=make_partition_str(),
            select_str=select_statement.no_semicolon()
        )
        return HQLGenerator.Statement(hql_statement)
github adidas / m3d-api / m3d / util / hql_generator.py View on Github external
                lambda s: HQLGenerator.Statement.MULTIPLE_RETURN_REGEX.sub(HQLGenerator.Statement.RETURN_CHAR, s)
            ])
github adidas / m3d-api / m3d / util / hql_generator.py View on Github external
def generate_drop_table_if_exists(table_name):
        hql_statement = 'DROP TABLE IF EXISTS {}'.format(table_name)
        return HQLGenerator.Statement(hql_statement)
github adidas / m3d-api / m3d / util / hql_generator.py View on Github external
def make_distribute_by_str():
                if len(self._distribute_columns) > 0:
                    return "DISTRIBUTE BY ({})".format(", ".join(self._distribute_columns))
                else:
                    return ""

            hql_statement = """
                {select_str}
                {from_str}
                {distribute_str}
            """.format(
                select_str=make_select_str(),
                from_str=make_from_str(),
                distribute_str=make_distribute_by_str()
            )
            return HQLGenerator.Statement(hql_statement)
github adidas / m3d-api / m3d / util / hql_generator.py View on Github external
def generate_drop_view(view_name):
        hql_statement = 'DROP VIEW {}'.format(view_name)
        return HQLGenerator.Statement(hql_statement)
github adidas / m3d-api / m3d / util / hql_generator.py View on Github external
def generate_create_database_if_not_exits(database_name):
        hql_statement = "CREATE DATABASE IF NOT EXISTS {}".format(database_name)
        return HQLGenerator.Statement(hql_statement)
github adidas / m3d-api / m3d / util / hql_generator.py View on Github external
def generate_drop_table(table_name):
        hql_statement = 'DROP TABLE {}'.format(table_name)
        return HQLGenerator.Statement(hql_statement)
github adidas / m3d-api / m3d / util / hql_generator.py View on Github external
def generate_describe(entity):
        hql_statement = "DESCRIBE {}".format(entity)
        return HQLGenerator.Statement(hql_statement)
github adidas / m3d-api / m3d / util / hql_generator.py View on Github external
                lambda s: HQLGenerator.Statement.MULTIPLE_SPACE_REGEX.sub(HQLGenerator.Statement.SPACE_CHAR, s),
                lambda s: HQLGenerator.Statement.MULTIPLE_RETURN_REGEX.sub(HQLGenerator.Statement.RETURN_CHAR, s)
github adidas / m3d-api / m3d / util / hql_generator.py View on Github external
def generate_alter_table_location(table_name, table_location):
        hql_statement = 'ALTER TABLE {} SET LOCATION "{}"'.format(table_name, table_location)
        return HQLGenerator.Statement(hql_statement)