Exemple #1
0
 def __valid_column_def(self, column_def, l_dict):
     """
     Check column definitions in scenario.yml and cache file columns
     """
     l_keys_list = list(l_dict.keys())
     if column_def != l_keys_list:
         inconsistent_columns = set(column_def) ^ set(l_keys_list)
         raise SqliteInvalid(
             "The columns %s is not consistent between scenario.yml and input cache."
             % ", ".join(inconsistent_columns))
Exemple #2
0
    def __call__(self):
        try:
            self.__sqlite_adptr.connect(self.__dbname)
            cur = self.__sqlite_adptr.fetch(
                'SELECT name FROM sqlite_master WHERE type="table" AND name="%s"'
                % self.__tblname
            )
            result = cur.fetchall()
            if self.__returns_bool is True:
                return True if result else False

            if not result and self.__returns_bool is False:
                raise SqliteInvalid("Sqlite table %s not found" % self.__tblname)

        finally:
            self.__sqlite_adptr.close()