A question about end-of-file #6049
Replies: 1 comment 14 replies
-
` The above exception was the direct cause of the following exception: Traceback (most recent call last): |
Beta Was this translation helpful? Give feedback.
-
` The above exception was the direct cause of the following exception: Traceback (most recent call last): |
Beta Was this translation helpful? Give feedback.
-
Hi,Team, I have a question about end-of-file, I know this is really difficult to check why this happened(maybe many reasons).
But I don’t know how to troubleshoot this problem now, hmm... could you give me some help?
and I will be very grateful if you can provide some suggestions here!
1.Exception message:
(1)sqlalchemy.exc.OperationalError: (cx_Oracle.OperationalError) ORA-03113: end-of-file on communication channel
query with orm, like below:
User.query.get(str(username))
(2)sqlalchemy.exc.DatabaseError: (cx_Oracle.DatabaseError) ORA-03150: end-of-file on communication channel for database link
query with engine by dblink, like below:
engine = create_engine(NewConfig.SQLALCHEMY_DATABASE_URI, poolclass=QueuePool, pool_size=20, max_overflow=5)
sql = "select * from xxx@xxxdb"
df = pd.read_sql_query(sql, engine) # pd is pandas
2.Version
os: CentOS Linux release 7.6.1810
python: 3.6.8
Flask-SQLAlchemy 2.4.4
SQLAlchemy 1.3.22
db: oracle 19c
3.Code segment
config.ini
SQLALCHEMY_DATABASE_URI = oracle://xxx:xxx@xx.xxx.x.xx:xxxx/?service_name=xxx.xxx.xxx
config.py
class NewConfig(Config):
SQLALCHEMY_DATABASE_URI = config.get('APP', 'SQLALCHEMY_DATABASE_URI')
SQLALCHEMY_ENGINE_OPTIONS = {
'poolclass': QueuePool,
'pool_size': 20,
"max_overflow": 5,
}
init.py
engine = create_engine(NewConfig.SQLALCHEMY_DATABASE_URI, poolclass=QueuePool, pool_size=20, max_overflow=5)
def create_app(conf_file):
app = Flask(name)
app.config.from_object(NewConfig)
db.init_app(app)
models.py
class User(UserMixin, db.Model):
tablename = 'USER'
username = db.Column(db.String(64), primary_key=True)
fullname = db.Column(db.String(512))
email = db.Column(db.String(512))
... ...
createtime = db.Column(db.DateTime, default=func.now())
lastmodifiedtime = db.Column(db.DateTime, default=func.now(), onupdate=func.now())
auth.py
@login_manager.user_loader
def load_user(username):
if 'user_id' not in session:
return User.query.get(str(username))
Have a nice day!
Beta Was this translation helpful? Give feedback.
All reactions