-
+
- {{ lib.render_field(form.csv_file, begin_sep_label, end_sep_label, begin_sep_field, end_sep_field) }}
+ {{ lib.render_field(form.csv_file, begin_sep_label, end_sep_label,
+ begin_sep_field, end_sep_field) }}
- {{ lib.render_field(form.table_name, begin_sep_label, end_sep_label, begin_sep_field, end_sep_field) }}
+ {{ lib.render_field(form.table_name, begin_sep_label,
+ end_sep_label, begin_sep_field, end_sep_field) }}
- {{ lib.render_field(form.database, begin_sep_label, end_sep_label, begin_sep_field, end_sep_field) }}
+ {{ lib.render_field(form.database, begin_sep_label, end_sep_label,
+ begin_sep_field, end_sep_field) }}
- {{ lib.render_field(form.schema, begin_sep_label, end_sep_label, begin_sep_field, end_sep_field) }}
+ {{ lib.render_field(form.schema, begin_sep_label, end_sep_label,
+ begin_sep_field, end_sep_field) }}
- {{ csv_macros.render_delimiter_field(form.delimiter, begin_sep_label, end_sep_label, begin_sep_field, end_sep_field) }}
+ {{ csv_macros.render_delimiter_field(form.delimiter,
+ begin_sep_label, end_sep_label, begin_sep_field, end_sep_field) }}
- {% call csv_macros.render_collapsable_form_group("accordion1", "File Settings") %}
-
- {{ lib.render_field(form.if_exists, begin_sep_label, end_sep_label, begin_sep_field,
- end_sep_field) }}
-
-
- {{ lib.render_field(form.skip_initial_space, begin_sep_label, end_sep_label, begin_sep_field,
- end_sep_field) }}
-
-
- {{ lib.render_field(form.skip_blank_lines, begin_sep_label, end_sep_label, begin_sep_field,
- end_sep_field) }}
-
-
- {{ lib.render_field(form.parse_dates, begin_sep_label, end_sep_label, begin_sep_field,
- end_sep_field) }}
-
-
- {{ lib.render_field(form.infer_datetime_format, begin_sep_label, end_sep_label, begin_sep_field,
- end_sep_field) }}
-
-
- {{ lib.render_field(form.decimal, begin_sep_label, end_sep_label, begin_sep_field,
- end_sep_field) }}
-
-
- {{ lib.render_field(form.null_values, begin_sep_label, end_sep_label, begin_sep_field,
- end_sep_field) }}
-
- {% endcall %}
- {% call csv_macros.render_collapsable_form_group("accordion2", "Columns") %}
-
- {{ lib.render_field(form.index_col, begin_sep_label, end_sep_label, begin_sep_field,
- end_sep_field) }}
-
-
- {{ lib.render_field(form.dataframe_index, begin_sep_label, end_sep_label, begin_sep_field,
- end_sep_field) }}
-
-
- {{ lib.render_field(form.index_label, begin_sep_label, end_sep_label, begin_sep_field,
- end_sep_field) }}
-
-
- {{ lib.render_field(form.use_cols, begin_sep_label, end_sep_label, begin_sep_field,
- end_sep_field) }}
-
-
- {{ lib.render_field(form.overwrite_duplicate, begin_sep_label, end_sep_label, begin_sep_field,
- end_sep_field) }}
-
-
- {{ lib.render_field(form.dtype, begin_sep_label, end_sep_label, begin_sep_field,
- end_sep_field) }}
-
- {% endcall %}
- {% call csv_macros.render_collapsable_form_group("accordion3", "Rows") %}
-
- {{ lib.render_field(form.header, begin_sep_label, end_sep_label, begin_sep_field, end_sep_field)
- }}
-
-
- {{ lib.render_field(form.nrows, begin_sep_label, end_sep_label, begin_sep_field, end_sep_field)
- }}
-
-
- {{ lib.render_field(form.skiprows, begin_sep_label, end_sep_label, begin_sep_field,
- end_sep_field) }}
-
+ {% call csv_macros.render_collapsable_form_group("accordion1", "File
+ Settings") %}
+
+ {{ lib.render_field(form.if_exists, begin_sep_label, end_sep_label,
+ begin_sep_field, end_sep_field) }}
+
+
+ {{ lib.render_field(form.skip_initial_space, begin_sep_label,
+ end_sep_label, begin_sep_field, end_sep_field) }}
+
+
+ {{ lib.render_field(form.skip_blank_lines, begin_sep_label, end_sep_label,
+ begin_sep_field, end_sep_field) }}
+
+
+ {{ lib.render_field(form.parse_dates, begin_sep_label, end_sep_label,
+ begin_sep_field, end_sep_field) }}
+
+
+ {{ lib.render_field(form.infer_datetime_format, begin_sep_label,
+ end_sep_label, begin_sep_field, end_sep_field) }}
+
+
+ {{ lib.render_field(form.day_first, begin_sep_label, end_sep_label,
+ begin_sep_field, end_sep_field) }}
+
+
+ {{ lib.render_field(form.decimal, begin_sep_label, end_sep_label,
+ begin_sep_field, end_sep_field) }}
+
+
+ {{ lib.render_field(form.null_values, begin_sep_label, end_sep_label,
+ begin_sep_field, end_sep_field) }}
+
+ {% endcall %} {% call csv_macros.render_collapsable_form_group("accordion2",
+ "Columns") %}
+
+ {{ lib.render_field(form.index_col, begin_sep_label, end_sep_label,
+ begin_sep_field, end_sep_field) }}
+
+
+ {{ lib.render_field(form.dataframe_index, begin_sep_label, end_sep_label,
+ begin_sep_field, end_sep_field) }}
+
+
+ {{ lib.render_field(form.index_label, begin_sep_label, end_sep_label,
+ begin_sep_field, end_sep_field) }}
+
+
+ {{ lib.render_field(form.use_cols, begin_sep_label, end_sep_label,
+ begin_sep_field, end_sep_field) }}
+
+
+ {{ lib.render_field(form.overwrite_duplicate, begin_sep_label,
+ end_sep_label, begin_sep_field, end_sep_field) }}
+
+
+ {{ lib.render_field(form.dtype, begin_sep_label, end_sep_label,
+ begin_sep_field, end_sep_field) }}
+
+ {% endcall %} {% call csv_macros.render_collapsable_form_group("accordion3",
+ "Rows") %}
+
+ {{ lib.render_field(form.header, begin_sep_label, end_sep_label,
+ begin_sep_field, end_sep_field) }}
+
+
+ {{ lib.render_field(form.nrows, begin_sep_label, end_sep_label,
+ begin_sep_field, end_sep_field) }}
+
+
+ {{ lib.render_field(form.skiprows, begin_sep_label, end_sep_label,
+ begin_sep_field, end_sep_field) }}
+
{% endcall %}
-{% endblock %}
-{% block add_tail_js %}
-
-{% endblock %}
-{% block tail_js %}
- {{ super() }}
- {{ schemas_selector }}
- {{ csv_scripts }}
-{% endblock %}
+{% endblock %} {% block add_tail_js %}
+
+{% endblock %} {% block tail_js %} {{ super() }} {{ schemas_selector }} {{
+csv_scripts }} {% endblock %}
diff --git a/superset/views/database/forms.py b/superset/views/database/forms.py
index 767f4bb4e5..36bd43e2fe 100644
--- a/superset/views/database/forms.py
+++ b/superset/views/database/forms.py
@@ -201,6 +201,10 @@ class CsvToDatabaseForm(UploadToDatabaseForm):
_("Interpret Datetime Format Automatically"),
description=_("Interpret the datetime format automatically"),
)
+ day_first = BooleanField(
+ _("Day First"),
+ description=_("DD/MM format dates, international and European format"),
+ )
decimal = StringField(
_("Decimal Character"),
default=".",
diff --git a/superset/views/database/views.py b/superset/views/database/views.py
index 43e89bcdf7..6f9344339e 100644
--- a/superset/views/database/views.py
+++ b/superset/views/database/views.py
@@ -168,6 +168,7 @@ class CsvToDatabaseView(CustomFormView):
form.skip_initial_space.data = False
form.skip_blank_lines.data = True
form.infer_datetime_format.data = True
+ form.day_first.data = False
form.decimal.data = "."
form.if_exists.data = "fail"
@@ -199,6 +200,7 @@ class CsvToDatabaseView(CustomFormView):
header=form.header.data if form.header.data else 0,
index_col=form.index_col.data,
infer_datetime_format=form.infer_datetime_format.data,
+ dayfirst=form.day_first.data,
iterator=True,
keep_default_na=not form.null_values.data,
usecols=form.use_cols.data if form.use_cols.data else None,