Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.
TypeScript analyticsanalytics-dashboardclickhouseelixirgoogle-analyticsmarketingopen-source-analyticsphoenixplausible-analyticspostgresqlprivacyprivacy-friendlyself-hostedsimple-analyticsstatisticstailwindcssweb-analyticswebsite-analyticswebsite-statswebsite-tracking
specify insert columns in import from s3 (#3968)
ruslandoga2ba4988c95cd
diff --git a/lib/plausible/imported/csv_importer.ex b/lib/plausible/imported/csv_importer.exindex 6376d851d3..c873000995 100644--- a/lib/plausible/imported/csv_importer.ex+++ b/lib/plausible/imported/csv_importer.ex@@ -43,9 +43,17 @@ defmodule Plausible.Imported.CSVImporter do{table, _, _} = parse_filename!(filename)s3_structure = input_structure!(table)+ s3_structure_cols_expr =+ s3_structure+ |> String.split(",", trim: true)+ |> Enum.map_join(", ", fn kv ->+ [col, _type] = String.split(kv)+ col+ end)+statement ="""- INSERT INTO {table:Identifier} \+ INSERT INTO {table:Identifier}(site_id, #{s3_structure_cols_expr}, import_id) \SELECT {site_id:UInt64} AS site_id, *, {import_id:UInt64} AS import_id \FROM s3({s3_url:String},{s3_access_key_id:String},{s3_secret_access_key:String},{s3_format:String},{s3_structure:String}) \WHERE date >= {start_date:Date} AND date <= {end_date:Date}\