コード例 #1
0
 def scheduleDeletion(archive_files, stay_of_execution):
     """See `IArchiveFileSet`."""
     clauses = [
         ArchiveFile.id.is_in(
             set(archive_file.id for archive_file in archive_files)),
         ArchiveFile.library_file == LibraryFileAlias.id,
         LibraryFileAlias.content == LibraryFileContent.id,
     ]
     new_date = _now() + stay_of_execution
     return_columns = [
         ArchiveFile.container, ArchiveFile.path, LibraryFileContent.sha256
     ]
     return list(
         IMasterStore(ArchiveFile).execute(
             Returning(BulkUpdate(
                 {ArchiveFile.scheduled_deletion_date: new_date},
                 table=ArchiveFile,
                 values=[LibraryFileAlias, LibraryFileContent],
                 where=And(*clauses)),
                       columns=return_columns)))
コード例 #2
0
ファイル: postgres.py プロジェクト: welitonfreitas/storm-py3
 def test_returning_column_context(self):
     column2 = TrackContext()
     insert = Insert({column1: elem1}, table1, primary_columns=column2)
     compile(Returning(insert))
     self.assertEquals(column2.context, COLUMN)
コード例 #3
0
 def test_returning_update(self):
     update = Update({column1: elem1},
                     table=table1,
                     primary_columns=(column2, column3))
     assert compile(Returning(update)) == (
         'UPDATE "table 1" SET column1=elem1 RETURNING column2, column3')