Category : flask-mysql

I have a flask app that connects with mysql using salalchemy. A strange error happens on DB query. `Traceback (most recent call last): File "/home/faisal/Desktop/work/nesting-app/env/lib/python3.8/site-packages/sqlalchemy/util/_collections.py", line 1008, in call return self.registry[key] KeyError: <greenlet.greenlet object at 0x7f22a0936a90 (otid=0x7f22a08ef100) current active started main> During handling of the above exception, another exception occurred: Traceback (most recent call last): ..

Read more

I want to write pytest cases for mysql python function by using mocker databases for below enter code here code can you help me to write pytest enter code here " def check_for_db(): db_name = os.environ.get(‘db_name’) mysql_hostname = os.environ.get(‘mysql_hostname’) mysql_username = os.environ.get(‘mysql_username’) mysql_pw =os.environ.get(‘mysql_pw’) conn = mysql.connector.connect(host=mysql_hostname,user=mysql_username,password=mysql_pw) cur = conn.cursor(buffered=True) sql_query = ‘SHOW DATABASES;’ cur.execute(sql_query) ..

Read more

I am building a python flask-Mysql app. I am building it using AWS cloud9. But When I run the code I am geting MYSQL_HOST key error. I am attaching code below. Is it because of the installation fault or code error.?` from flask import Flask, request, render_template from flask_mysqldb import MySQL application = Flask(__name__) application.config[‘MYSQL_HOST’] ..

Read more

I’ve been trying to install flask-mysqldb in python 3.8 using pip install flask-mysqldb, but every time I try it gives me an error that says The error is: $ pip install flask-mysqldb Requirement already satisfied: flask-mysqldb in c:usersroshanappdatalocalprogramspythonpython38-32libsite-packages (0.2.0) Requirement already satisfied: Flask>=0.10 in c:usersroshanappdatalocalprogramspythonpython38-32libsite-packages (from flask-mysqldb) (1.1.2) Requirement already satisfied: mysqlclient in c:usersroshanappdatalocalprogramspythonpython38-32libsite-packages (from ..

Read more