This gem runs in .
Overview
Use the MultiColumnRename gem to efficiently rename several columns in your dataset at the same time. This gem allows you to apply a consistent naming pattern by adding a prefix or suffix to selected columns, or perform advanced renaming using custom SQL expressions.Prerequisites
- Add
prophecy_basicspackage version 1.0.0 or higher to your project.
Parameters
| Field | Description |
|---|---|
| Select columns to rename | Set of columns that you will rename. |
| Rename method | How you will rename columns. You can either add a prefix/suffix, or choose advanced rename (SQL expression). |
Example
Assume you have the following table that includes the weather forecast for the next four days.| DatePrediction | TemperatureCelsius | HumidityPercent | WindSpeed | Condition |
|---|---|---|---|---|
| 2025-03-01 | 15 | 65 | 10 | Sunny |
| 2025-03-02 | 17 | 70 | 12 | Cloudy |
| 2025-03-03 | 16 | 68 | 11 | Rainy |
| 2025-03-04 | 14 | 72 | 9 | Sunny |
- Create a MultiColumnRename gem.
- Open the gem configuration and stay in the Visual view.
- Under Select columns to rename, select all columns.
- For the Rename method, choose Advanced rename.
- Click Select expression > Function.
-
Search for and select the
lowerfunction. -
Inside of the
lowerfunction, click expr > Custom Code. -
Inside of the code box, write
column_name. This applies the function to the column name. - Click Done on the code box, and then click Save on your gem.
Result
After saving and running the gem, all selected columns will be renamed using the lower function. In this case, all column names will be lowercase in the output table.dateprediction | temperaturecelsius | humiditypercent | windspeed | condition |
|---|---|---|---|---|
| 2025-03-01 | 15 | 65 | 10 | Sunny |
| 2025-03-02 | 17 | 70 | 12 | Cloudy |
| 2025-03-03 | 16 | 68 | 11 | Rainy |
| 2025-03-04 | 14 | 72 | 9 | Sunny |

