error image is here
In the current version of Apache Superset, I’m encountering an issue with connecting to SQLite, even after setting PREVENT_UNSAFE_DB_CONNECTIONS = False
in the config file. Can anyone suggest a solution to resolve this error?
I try changing the PREVENT_UNSAFE_DB_CONNECTIONS = False
in the config file
This is My External Flash App Code where I call the external API , convert into csv and save into sqlite ,
Also Suggest me How to Connect REST API Directly to Apache Superset without Connceting DB
from flask import Flask, jsonify
from flask_sqlalchemy import SQLAlchemy
import requests
import pandas as pd
from io import StringIO
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///data.db'
db = SQLAlchemy(app)
class Data(db.Model):
id = db.Column(db.Integer, primary_key=True)
data = db.Column(db.Text, nullable=False)
def init_db():
with app.app_context():
db.create_all()
@app.route('/data', methods=['GET'])
def get_data():
# Fetch data from REST API
response = requests.get('https://jsonplaceholder.typicode.com/posts')
data = response.json()
# Convert data to CSV format
df = pd.DataFrame(data)
csv_data = df.to_csv(index=False)
# Store data in the database
new_data = Data(data=csv_data)
db.session.add(new_data)
db.session.commit()
# Return data as CSV
return csv_data, 200, {'Content-Type': 'text/csv'}
if __name__ == '__main__':
init_db()
app.run(host='0.0.0.0', port=5000)
Sagar Chauhan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.