Name databases, tables, and columns - Amazon Athena

Name databases, tables, and columns

When you create schema in AWS Glue to query in Athena, consider the following:

  • Acceptable characters for database names, table names, and column names in AWS Glue must be a UTF-8 string and should be in lower case. Note that Athena automatically lowers any upper case names in DDL queries when it creates databases, tables, or columns. The string must not be less than 1 or more than 255 bytes long. Characters that can be used include spaces.

  • Currently, it is possible to have leading spaces at the start of names. Because these leading spaces can be hard to detect and can cause usability issues after creation, avoid inadvertently creating object names with leading spaces.

  • If you use an AWS::Glue::Database AWS CloudFormation template to create an AWS Glue database and do not specify a database name, AWS Glue automatically generates a database name in the format resource_name–random_string that is not compatible with Athena.

  • You can use the AWS Glue Catalog Manager to rename columns, but not table names or database names. To work around this limitation, you must use a definition of the old database to create a database with the new name. Then you use definitions of the tables from the old database to re-create the tables in the new database. To do this, you can use the AWS CLI or AWS Glue SDK. For steps, see Use the AWS CLI to recreate an AWS Glue database and its tables.

For more information about databases and tables in AWS Glue, see Databases and Tables in the AWS Glue Developer Guide.