How to rename a column in Keboola ?

Need to change the name of a column in an existing table in Keboola and don’t know how to do it? Below you will find even 3 ways to do it.

Bára Kalačová
22. January 2024

Keboola serves as an end-to-end data management solution. From extracting data from multiple sources, to data transformations, to storing data in a data warehouse and then preparing a reporting layer for any visualization tool. What it doesn’t allow, however, is to directly rename columns in existing tables. This tutorial will walk you through a solution to achieve this. This can be especially useful when aligning your data schema with evolving business needs.

Basic assumptions

The first and essential prerequisite for changing the column name is to have an active Keboola account and to know the tool at least at a basic user level.

Want to learn with Keboola? Check out the introductory course here.

Technique 1 Using Keboola transformations

This method of renaming a column uses the Keboola Transformation.

1. Create a transformation

In the “transformations” section of the Keboola project, create a new transformation – SQL, Python, R, etc – the choice depends on your preferences and current setup.

2. Write a transformation script

Write a script that extracts all the data from the original table, but renames the desired column.

  • For example, in SQL, you can use a query such as: SELECT col1 AS new_col_name, col2, col3, … FROM original_table;
  • Ensure that the script converts the result to a new table or overwrites the existing table as per your requirement.

Tips

Always back up your data and create a snapshot before making schema changes.

Document the changes for future use and communication within the team.

3. Start the transformation

After the transformation is complete, verify that the table has the column renames as required.

Pros

Does not require manual data transfer;

Integrates seamlessly into existing pipelines.

Cons

May require advanced SQL or programming skills; can be resource intensive for large data sets.

Technique 2 – Using a third party tool or Excel to the rescue

The next method is briefly as follows – export the table, rename the column using a third party tool and then import it back into Keboola.

1. Data export

Export data from an existing table in Keboola to CSV or other suitable format.

2. Use an external renaming tool

Use a data manipulation tool to rename the column (simply type the column name in Microsoft Excel, Google Sheets or via a Python script).

Save the modified data as a CSV.

3. Import the data again

In Storage-i in Keboola, upload the new table as a CSV (note the separator option). Replace the original table with the new one wherever the original one entered and delete the original one.

Pros

It allows flexible and visual manipulation of data; it can be easier for users who are familiar with tools such as Excel.

Cons

Time consuming for large data sets; not automated.

Technique 3 – Rename a column in Snowflake writer

If you don’t need to change the names in the whole data warehouse, but it is enough to rename the column at the writer level, you don’t need to export and upload any data.

Change Column Name

In the “Components” section, locate your Snowflake writer. In “Tables” choose the “Name” of the table with the column you want to rename.

In “Column Name” type the name you want. *this name is not overwritten in Keboola Storage, but only exists in this particular writer.

Each coin has two sides. According to Petr Šimeček, one of the founders of Kebool, it is a more complex technical problem than it may seem at first glance. “Renaming (potentially) breaks a lot of things around and requires changes in input mapping and code.” Simecek says.

Each method has its advantages and disadvantages. The choice depends on the specific requirements of the project, the volume of data, and the technical expertise available. For example, if automation is critical or you have a giant table, using transformations within Keboola is more appropriate. Conversely, for smaller datasets or one-off jobs, third-party tools might be easier to access.

What method do you choose to change the column name in Keboola ?

Contact us

Need help setting up, pricing or implementing Keboola?
We’re here for you.

Read some of our other articles