Jan 31, 2022

Add data from CSVs with different column orders

Add data to a Data Source from a CSV, even if the columns are in a different order to the one used when the Data Source was created.
Pablo Marcos Oltra
Backend Engineer

Some of our users explained that sometimes the column order in CSV data files they wanted to add to a Data Source was not consistent with the column order in the Data Source. This resulted in data going into quarantine.

We improved Tinybird so that even if the columns are in a different order to the one used when the Data Source was created, you can add data to a Data Source from a CSV, provided, of course, that all the column names are in the CSV header.

Let’s look at an example of appending data to a exiting Data Source of movie likes and dislikes. The original Data Source was created from a CSV with this column order:

Depending on the source of the data and how the CSVs are generated, the order of the columns might not be guaranteed. You could very well find a CSV with the same columns in different order:

This is not a problem since the data will be appended correctly.

Append from the UI

In the UI, to add data the new data to the movies Data Source just select add Data Source and upload the file named movies.csv, where the CSV header contains the column names.

Appending data with reordered columns

The new data is appended to the movies Data Source.

Append from the API

From the API, to append data into the existing Data Source movies, you specify the mode and the name. The order of the columns doesn’t matter, provided the CSV header contains the column names.

Append from the CLI

From the CLI, append the new data to the movies Data Source without worrying about the column order, provided the CSV header contains the column names.

Login to your account to check this out and tell us what you think in our Slack.

Do you like this post?

Related posts

Real-time Data Visualization: How to build faster dashboards
A new way to create intermediate Data Sources in Tinybird
Tinybird
Team
Jun 15, 2023
Export data from Tinybird to Amazon S3 with the S3 Sink
Tinybird
Team
Mar 21, 2024
Tinybird: A ksqlDB alternative when stateful stream processing isn't enough
To the limits of SQL... and beyond
Automating data workflows with plaintext files and Git
Chatting GraphQL with Jamie Barton of Grafbase
Tinybird
Team
Apr 24, 2023
What it takes to build a real-time recommendation system
We launched an open source ClickHouse Knowledge Base
Tinybird
Team
Oct 11, 2022
The definition of real-time data

Build fast data products, faster.

Try Tinybird and bring your data sources together and enable engineers to build with data in minutes. No credit card required, free to get started.
Need more? Contact sales for Enterprise support.