Skip to content

Column names

In Autory, one frequently works with tables, whether it be tables from Excel, tables from SQL databases, tables from CSV files, tables from Feather files, etc.

How other systems handle column names

Various other systems that Autory can integrate with have their own rules in regard to column names:

  • Some treat columns case-insensitively, while others treat columns case-sensitively.
  • Some allow duplicate columns, and some do not.
    • Among those that do not allow duplicate columns, some will throw an error, while others will drop the duplicate columns.
    • Among those that drop columns, some will keep the left-most column, while others will keep the right-most column.
  • Some allow any data type for column names, while others require column names to be strings.
  • Some allow empty (unnamed) column names, while others do not.

How Autory handles column names

Autory uses the following rules when working with column names:

  • It always treats column names case-insensitively.
  • It does not allow duplicate column names.
    • It will keep only the first (left-most) column with a given name when there are duplicates.
  • It always converts column names to strings.
  • It does not allow unnamed columns.

More specific circumstances are described below.

When performing SQL queries

In many cases, Autory allows you to perform a SQL query on a table in the same function call that reads the table. When querying a SQL database, the result is deduplicated according to the above-mentioned rules. When querying a table from another source, like an Excel file, a CSV file, or a JSON file, the deduplication happens before AND after the SQL query is executed.

When reading from Excel

  • This is typically done using the excelTable function.
  • When reading a ListObject, Excel already ensures that each column has a unique name, that there are no unnamed columns, and that every column name is a string.
  • However, when reading an arbitrary 2D named range, duplicate column names, empty column names, and non-string column names may exist. These are deduplicated according to the rules above.
  • If there is a SQL query, the deduplication happens before AND after the SQL query is executed.

When reading from JSON files

  • This is typically done using the resultsJsonToTable function.
  • Column names are case-insensitive once they reach Autory, even though keys are case-sensitive in JSON.
  • Duplicate keys are not valid in JSON, but they can exist, since it's just a text file. When they do, they are deduplicated according to the rules above.
  • If there is a SQL query, the deduplication happens before AND after the SQL query is executed.

When reading from CSV files

  • This is typically done using the csvToTable function.
  • Column names are case-insensitive once they reach Autory, even though columns are case-sensitive in CSV.
  • Duplicate columns can exist in CSV. When they do, they are deduplicated according to the rules above.
  • If there is a SQL query, the deduplication happens before AND after the SQL query is executed.

When reading from Feather files

  • This is typically done using the featherToTable function.
  • Column names are case-insensitive once they reach Autory, even though columns are case-sensitive in Feather files.
  • Duplicate columns can exist in Feather files. When they do, they are deduplicated according to the rules above.
  • If there is a SQL query, the deduplication happens before AND after the SQL query is executed.

When reading from a database

  • This is typically done using the sqlToTable function.
  • Column names are case-insensitive once they reach Autory, even if they are not case-insensitive in the SQL database.
  • Whether they are case-insensitive in the source SQL database depends on the database engine being used.
  • Duplicate columns can exist in SQL databases. When they do, they are deduplicated according to the rules above.
  • Deduplication is only performed after the SQL query is executed.