Hello!
There is an application on Flask.
from flask_sqlalchemy import SQLAlchemy app = Flask(__name__) app.config.from_pyfile(filename='settings.py', silent=True) db = SQLAlchemy() db.init_app(app) How to properly connect to the database or what settings to make so that the daemon can process and write to the database in parallel, and the Flask application shows a webcam. Now when I try to open the web, I get a 502 error, and in the logs:
fdb.fbcore.DatabaseError: ('Error while connecting to database:\n- SQLCODE: -902\n- I/O error during "lock" operation for file "main.fdb"\n- Database already opened with engine instance, incompatible with current', -902, 335544344) I have already tried many different variations, but there is no result. Connecting to the database occurs directly to the file, not through the network. When I stop the daemon, the web works fine, that is, selects from the database work fine. If the daemon is started, the webcam does not work again.
I would be happy to work example, how can this be implemented.
Thank!
update: I tried to adjust the database isolation level in the following way:
from fdb.fbcore import ISOLATION_LEVEL_READ_COMMITED_LEGACY class TPBAlchemy(SQLAlchemy): def apply_driver_hacks(self, app_, info, options): if 'isolation_level' not in options: options['isolation_level'] = ISOLATION_LEVEL_READ_COMMITED_LEGACY return super(TPBAlchemy, self).apply_driver_hacks(app_, info, options) And instead of:
db = SQLAlchemy() Wrote:
db = TPBAlchemy() But this only gave rise to another error:
TypeError: Invalid argument(s) 'isolation_level' sent to create_engine(), using configuration FBDialect_fdb/QueuePool/Engine. Please check that the keyword arguments are appropriate for this combination of components.