Esempio n. 1
0
    def _init_version_info_model(self) -> None:

        with _create_scoped_session(self.scoped_session, True) as session:
            version_info = models.VersionInfoModel.find(session)
            if version_info is not None:
                return

            version_info = models.VersionInfoModel(
                schema_version=models.SCHEMA_VERSION, library_version=version.__version__
            )
            session.add(version_info)
Esempio n. 2
0
    def _init_version_info_model(self) -> None:

        session = self.scoped_session()

        version_info = models.VersionInfoModel.find(session)
        if version_info is not None:
            # Terminate transaction explicitly to avoid connection timeout during transaction.
            RDBStorage._commit(session)
            return

        version_info = models.VersionInfoModel(
            schema_version=models.SCHEMA_VERSION,
            library_version=version.__version__)

        session.add(version_info)
        RDBStorage._commit_with_integrity_check(session)