def list_records(self): try: query = self.datastore.db_session.query(SqlIntegerSequencedItem) return list(query) except OperationalError as e: self.datastore.db_session.rollback() raise DatastoreTableError(e)
def create_record(self): try: record = SqlIntegerSequencedItem() self.datastore.db_session.add(record) self.datastore.db_session.commit() except OperationalError as e: self.datastore.db_session.rollback() raise DatastoreTableError(e) return record
def create_record(self): record = CqlIntegerSequencedItem(s=uuid4(), p=0, t='topic', d='{}') try: record.save() except (CQLEngineException, NoHostAvailable) as e: raise DatastoreConnectionError(e) except InvalidRequest as e: raise DatastoreTableError(e) return record
def create_record(self): try: record = IntegerSequencedItemRecord(sequence_id=uuid4(), position=0) self.datastore.session.add(record) self.datastore.session.commit() except OperationalError as e: self.datastore.session.rollback() raise DatastoreTableError(e) return record
def list_records(self): try: query = self.datastore.session.query(IntegerSequencedNoIDRecord) return list(query) except (OperationalError, ProgrammingError) as e: # OperationalError from sqlite, ProgrammingError from psycopg2. self.datastore.session.rollback() raise DatastoreTableError(e) finally: self.datastore.session.close()
def create_record(self): try: record = IntegerSequencedNoIDRecord(sequence_id=uuid4(), position=0, topic="topic", state=b"{}") self.datastore.session.add(record) self.datastore.session.commit() except (OperationalError, ProgrammingError) as e: self.datastore.session.rollback() raise DatastoreTableError(e) return record