>>call_special_firebird_method
Not understand. What method? You mean fdb method?

I found method _Connection__set_default_tpb and use it.
app = Flask(__name__)
app.config.from_pyfile(filename='settings.py', silent=True)
db = SQLAlchemy(app=app)
engine = create_engine(settings.SQLALCHEMY_DATABASE_URI)

@event.listens_for(engine, 'connect')
def receive_connect(dbapi_connection, connection_record):
    dbapi_connection._Connection__set_default_tpb(
ISOLATION_LEVEL_READ_COMMITED_LEGACY)
This function is performed, but the same result - error in logs about 
"lock".

пятница, 3 марта 2017 г., 20:08:45 UTC+3 пользователь Евгений Рымарев 
написал:
>
> Hello everyone!
> I have Flask app with using flask_sqlalchemy:
>
> from flask import Flask
> from flask_sqlalchemy import SQLAlchemy
> app = Flask(__name__)
> app.config.from_pyfile(filename='settings.py', silent=True)
> db = SQLAlchemy(app=app)
>
> I want connect to same database from daemon. In daemon i just import db 
> and use db.engine.execute for SQLAlchemy queries.  
> But when daemon starts main app can't connect to database.
> In log i see that:
> 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 trying use isolation level:
> 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 replace this:
> db = SQLAlchemy()
>
> To:
> db = TPBAlchemy()
>
> But this only make 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.
>
> I would appreciate the full example to address my issue.  
> Thanks!
>

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to