src/dirbs/dimensions/base.py
def sql(self, conn, app_config, virt_imei_range_start, virt_imei_range_end, curr_date=None):
        """
        Interface for a dimension to return the SQL fragment associated with it.

        :param conn: database connection
        :param app_config: dirbs config obj
        :param virt_imei_range_start: virtual imei shard range start
        :param virt_imei_range_end: virtual imei shard range end
        :param curr_date: current date by user (default None)
        :return: SQL
        """
        base_sql = self._matching_imeis_sql(conn, app_config, virt_imei_range_start, virt_imei_range_end,
                                            curr_date)
        if type(base_sql) == bytes:
            base_sql = str(base_sql, conn.encoding)

        # Dimensions should convert their query fragments to strings before returning
        assert type(base_sql) == str

        if self.invert:
            network_imeis_shard = partition_utils.imei_shard_name(base_name='network_imeis',
                                                                  virt_imei_range_start=virt_imei_range_start,
                                                                  virt_imei_range_end=virt_imei_range_end)

            dim_sql = sql.SQL("""SELECT imei_norm
                                   FROM {network_imeis_shard}
                                  WHERE NOT EXISTS(SELECT imei_norm
                                                     FROM ({base_dim_sql}) base
                                                    WHERE imei_norm = {network_imeis_shard}.imei_norm)
                              """).format(network_imeis_shard=sql.Identifier(network_imeis_shard),  # noqa: Q449
                                          base_dim_sql=sql.SQL(base_sql))
        else:
            dim_sql = sql.SQL(base_sql)
        return dim_sql

        Interface for a dimension to return the SQL fragment associated with it.

        :param conn: database connection
        :param app_config: dirbs config obj
        :param virt_imei_range_start: virtual imei shard range start
        :param virt_imei_range_end: virtual imei shard range end
        :param curr_date: current date by user (default None)
        :return: SQL
        
Interface for a dimension to return the SQL fragment associated with it.
Interface for a dimension to return the SQL fragment associated with it .
def sql(self, conn, app_config, virt_imei_range_start, virt_imei_range_end, curr_date=None):
        base_sql = self._matching_imeis_sql(conn, app_config, virt_imei_range_start, virt_imei_range_end,
                                            curr_date)
        if type(base_sql) == bytes:
            base_sql = str(base_sql, conn.encoding)
        assert type(base_sql) == str
        if self.invert:
            network_imeis_shard = partition_utils.imei_shard_name(base_name='network_imeis',
                                                                  virt_imei_range_start=virt_imei_range_start,
                                                                  virt_imei_range_end=virt_imei_range_end)
            dim_sql = sql.SQL("""SELECT imei_norm
                                   FROM {network_imeis_shard}
                                  WHERE NOT EXISTS(SELECT imei_norm
                                                     FROM ({base_dim_sql}) base
                                                    WHERE imei_norm = {network_imeis_shard}.imei_norm)
                              """).format(network_imeis_shard=sql.Identifier(network_imeis_shard),  
                                          base_dim_sql=sql.SQL(base_sql))
        else:
            dim_sql = sql.SQL(base_sql)
        return dim_sql
def sql ( self , conn , app_config , virt_imei_range_start , virt_imei_range_end , curr_date = None ) : base_sql = self . _matching_imeis_sql ( conn , app_config , virt_imei_range_start , virt_imei_range_end , curr_date ) if type ( base_sql ) == bytes : base_sql = str ( base_sql , conn . encoding ) assert type ( base_sql ) == str if self . invert : network_imeis_shard = partition_utils . imei_shard_name ( base_name = 'network_imeis' , virt_imei_range_start = virt_imei_range_start , virt_imei_range_end = virt_imei_range_end ) dim_sql = sql . SQL ( """SELECT imei_norm
                                   FROM {network_imeis_shard}
                                  WHERE NOT EXISTS(SELECT imei_norm
                                                     FROM ({base_dim_sql}) base
                                                    WHERE imei_norm = {network_imeis_shard}.imei_norm)
                              """ ) . format ( network_imeis_shard = sql . Identifier ( network_imeis_shard ) , base_dim_sql = sql . SQL ( base_sql ) ) else : dim_sql = sql . SQL ( base_sql ) return dim_sql
Interface for a dimension to return the SQL fragment associated with it.
Interface for a dimension to return the SQL fragment associated with it .
"""
        Interface for a dimension to return the SQL fragment associated with it.

        :param conn: database connection
        :param app_config: dirbs config obj
        :param virt_imei_range_start: virtual imei shard range start
        :param virt_imei_range_end: virtual imei shard range end
        :param curr_date: current date by user (default None)
        :return: SQL
        """ # Dimensions should convert their query fragments to strings before returning # noqa: Q449
None
self
conn
None
app_config
dirbs config obj
dirbs config obj
virt_imei_range_start
virtual imei shard range start
virtual imei shard range start
virt_imei_range_end
virtual imei shard range end
virtual imei shard range end
curr_date
current date by user (default None)
current date by user ( default None )