Dynamic Table Mapping
Dynamic Table Mapping allows you to automatically create destination tables and route files to them based on a regex pattern applied to file paths. This eliminates the need to manually configure individual tables.
The following video tutorial demonstrates how to set up a connection using Dynamic Table Mapping, configure the regex pattern, and validate how file paths map to destination tables.
When to use Dynamic Table Mapping
Dynamic Table Mapping is suitable for the following scenarios:
- Your application exports multiple entities, such as sales, orders, and inventory, as separate files or folders.
- The files or directories follow a consistent naming pattern, such as
export/<entity>/<date>.csv, where<entity>is the table name. - You have many tables or expect new ones to appear over time.
An example use case is Guidewire Cloud Data Access (CDA), which delivers incremental InsuranceSuite data as Parquet files into an Amazon S3 bucket. Since each Guidewire table resides in its own folder, Dynamic Table Mapping can use the folder name as the table name, allowing the folder structure to map directly to destination tables.
Supported connectors
Fivetran supports Dynamic table mapping for the following connectors:
Setup instructions
Follow the steps in this section to configure a connection using Dynamic Table Mapping, define and validate a table extraction pattern, and sync your files to dynamically created destination tables.
For step-by-step guidance on setting up a connection with Dynamic Table Mapping, see the video tutorial.
(Optional) Specify base folder path
In the connection setup form, under the Connect section, specify the Base folder path to restrict the directories Fivetran scans for files. For best performance, set this path to the lowest common parent folder that contains all target files. For example, if your files are exports/customers/data_20251016.csv and exports/products/data_20251016.csv, the lowest common parent folder is exports.
Choose file mapping method
Select Dynamically extract tables. This option extracts destination table names from file paths using a single regex pattern with a named capture group.
If you want to sync files to a single destination table or a fixed set of known tables, use Define per table instead.
Specify table extraction pattern
Specify a regex pattern with exactly one named capture group called table. The capture group identifies the part of the file path to use as the destination table name.
- Required structure:
(?<table>...) - The
...represents the part of the file path you want to extract as the table name. For example, you can use\w+to capture a word.
If you specified a base folder path, the regex is applied to file paths within that folder and its subfolders. Omit the base folder prefix from the regex.
See the table below for examples of table extraction patterns:
| Scenario | File path | Base folder path | Pattern | Extracted table names |
|---|---|---|---|---|
| Date suffix in filename | finance/reports/sales_2025_01.json and finance/reports/transactions_2025_01.json | finance/reports | (?<table>\w+)_\d{4}_\d{2}\.json | sales and transactions |
| Files grouped by folder | exports/customers/data_20251016.csv and exports/products/data_20251016.csv | exports | (?<table>\w+)/data_\d{8}\.csv | customers and products |
| Multiple nested folders | documents/invoices/client/acme/file.csv and documents/contracts/client/acme/file.csv | documents | (?<table>\w+)/.*\.csv | invoices and contracts |
See Best practices and Regex components for best practices for defining a table extraction pattern and commonly used regex components, respectively.
Validate table extraction pattern
- Click Preview. We display up to five examples of how your existing files map to tables.
- Review the table mappings.
- If required, modify the regex pattern and preview the mappings again.
Initiate sync
Click Save & Test. Fivetran tests and validates the connection.
Once the connection tests pass, click Continue.
Choose one of the following sync options:
- Start syncing all my data now
- I need to customize data before syncing
- I'll sync later
Click Start initial sync.
During the initial sync, we do the following:
- Scan all files that match your configuration.
- Use the table extraction pattern to determine table names.
- Create the destination tables and start loading data.
On subsequent syncs, Fivetran automatically routes new files that match the pattern to the appropriate tables. If a file maps to a new table, Fivetran creates the table based on your Schema Change Handling settings.
Dynamic Table Mapping eliminates the need to configure each table manually. You can control the creation of new tables using Schema Change Handling settings.
Regex components
The following are commonly used regex components:
\w+– Matches one or more letters, digits, or underscores. Use it to capture table names.\d{8}– Matches exactly eight digits, used for dates in the YYYYMMDD format (for example, 20250115).\d{4}– Matches exactly four digits, used for years (for example, 2025).\.csv– Matches a literal.csvfile extension. Escape the dot with a backslash..*– Matches any sequence of characters. Use cautiously, as it can match more than intended and reduce precision.
Best practices
We recommend following these best practices when defining a table extraction pattern:
- Use
\w+to match word characters, including letters, numbers, and underscores. - Escape special characters with a backslash. For example, use
\.csvinstead of.csv. - Use
\d{n}to match exactlyndigits. - Test your regular expression on Regex101.
- Keep patterns simple and specific.
- Include only one instance of
(?<table>...). - Avoid using
.*in your table capture group.