コード例 #1
0
ファイル: __init__.py プロジェクト: ZoltanTakacs/pynonymizer
    def __estimate_dumpsize(self):
        """
        Makes a guess on the dump size using internal database metrics
        :return: A value in bytes, or None (unknown)
        """
        statement = query_factory.get_dumpsize_estimate(self.db_name)
        process_output = self.__runner.get_single_result(statement)

        try:
            return int(process_output) * self.__DUMPSIZE_ESTIMATE_INFLATION
        except ValueError:
            # Value unparsable, likely NULL
            return None
コード例 #2
0
def test_get_dumpsize_estimate():
    assert (
        query_factory.get_dumpsize_estimate(
            "test") == "SELECT data_bytes FROM "
        "(SELECT SUM(data_length) AS data_bytes "
        "FROM information_schema.tables WHERE table_schema = 'test') AS data;")