Skip to main content

Spaces in METADATA$FILENAME

Error

When working with external tables, you may see unexpected spaces in METADATA$FILENAME values. This can result in incorrect file path references, failed lookups, or broken downstream logic that depends on clean metadata values.

Possible Causes

  • CSV parsing configuration: File headers contain extra spaces or incorrect quoting, which affects how metadata columns are populated.
  • File pattern and stage setup: Incorrect file path selection or column mapping in the external table configuration introduces extra whitespace.
  • External table column mapping: Spaces appear in METADATA$FILENAME due to how the external table parses and maps source files.
  • Metadata extraction formatting: Extra spaces are generated between database names or during file processing.

Possible Solutions

  • Review your external table configuration and confirm that file patterns match the expected file paths without extra whitespace.
  • Check CSV formatting options such as quoting, delimiters, and header row handling. Make sure headers don't contain leading or trailing spaces.
  • Validate column mapping in your external table to ensure METADATA$FILENAME is correctly populated.
  • Use a TRIM() function on the METADATA$FILENAME column to remove unwanted spaces if the source files can't be corrected.