mirror of
https://github.com/apache/superset.git
synced 2026-04-20 00:24:38 +00:00
[csv upload] Use python's named temp file (#9047)
* [csv upload] Use python's named temp file * [csv upload] stream write uploaded file * Added missing ensure that configured path exists * Fix, lint * [csv upload] remove python's tmp file default delete behaviour
This commit is contained in:
committed by
GitHub
parent
d4d7134bf8
commit
24ec89a800
@@ -34,7 +34,6 @@ from sqlalchemy.ext.compiler import compiles
|
||||
from sqlalchemy.sql import quoted_name, text
|
||||
from sqlalchemy.sql.expression import ColumnClause, ColumnElement, Select, TextAsFrom
|
||||
from sqlalchemy.types import TypeEngine
|
||||
from werkzeug.utils import secure_filename
|
||||
|
||||
from superset import app, sql_parse
|
||||
from superset.utils import core as utils
|
||||
@@ -357,9 +356,6 @@ class BaseEngineSpec: # pylint: disable=too-many-public-methods
|
||||
:param kwargs: params to be passed to DataFrame.read_csv
|
||||
:return: Pandas DataFrame containing data from csv
|
||||
"""
|
||||
kwargs["filepath_or_buffer"] = (
|
||||
config["UPLOAD_FOLDER"] + kwargs["filepath_or_buffer"]
|
||||
)
|
||||
kwargs["encoding"] = "utf-8"
|
||||
kwargs["iterator"] = True
|
||||
chunks = pd.read_csv(**kwargs)
|
||||
@@ -394,7 +390,8 @@ class BaseEngineSpec: # pylint: disable=too-many-public-methods
|
||||
extension is not None and extension[1:] in config["ALLOWED_EXTENSIONS"]
|
||||
)
|
||||
|
||||
filename = secure_filename(form.csv_file.data.filename)
|
||||
filename = form.csv_file.data.filename
|
||||
|
||||
if not _allowed_file(filename):
|
||||
raise Exception("Invalid file type selected")
|
||||
csv_to_df_kwargs = {
|
||||
|
||||
Reference in New Issue
Block a user