We offer several options to sync files to your destination. You can:
- Add a Cloud-based Storage connector to sync files from your storage bucket
- Configure a Magic Folder connector to sync files from your cloud folder
- Transfer files using File Transfer Protocols
- Connect to Google Sheets
- Email files
Cloud-based storagelink
Sync files from a cloud-based storage service to your destination. Fivetran supports syncing files from the following cloud-based storage services:
Magic Folder Betalink
Magic Folder connectors sync any supported file from your cloud folder as a table within a schema in your destination.
You can use your cloud folder’s URL to configure the connectors. Fivetran automatically syncs the files from your folder as unique tables to your destination. That is, each file in your source becomes a table in your destination. Fivetran supports syncing multiple worksheets from your spreadsheet (Microsoft Excel and Google Sheets) files as unique destination tables.
Fivetran detects the changes you make to the existing files in your cloud folder and syncs and updates your destination tables.
Fivetran supports syncing files from the following cloud folders:
- Box
- Dropbox
- Google Drive
- OneDrive Beta
- SharePoint Beta
Merge Mode Betalink
Merge Mode allows Magic Folder connectors to sync multiple files into a single destination table instead of unique tables.
File transfer protocolslink
Sync files from your FTP or SSH server to your destination. Fivetran supports syncing files using:
Sync overviewlink
Cloud-based storage connectorslink
Our integration with storage services is optimized for buckets that receive periodic, automatic data dumps. These could be internal reports generated by your own tools, or APIs that we haven’t yet offered full support for.
File storage connections occur at the table level. Each Fivetran connector you create (shown below in the blue connection icon circle) connects to a single storage bucket, and its underlying data is loaded into a single destination table. Any files added to that bucket in the specified folder will be pulled and loaded into the specified destination table.
You can configure multiple storage connectors such that they sync into a single schema. All file storage cloud connections are pull integrations – Fivetran periodically pulls new or changed data from the source bucket.
Naming
You can assign custom schema and table names while building your connector. Column names are generated based on the uploaded files. For a CSV, there will be one column for each entry in the first line. For a JSON file, there will be one column for each top level field in the JSON object.
If you change the name of a file in your bucket, all data in that file will be re-imported, which may result in duplicate values within that table.
Primary keys
Fivetran adds the below three columns as composite primary keys for a table. _file
and _line
are composite primary keys for all configuration options. The column _modified
is an additional primary key that is added if the Modified File Merge option is set to the append_file
.
COLUMN | DATA TYPE |
---|---|
_file 🔑 | TEXT |
_line 🔑 | INT |
_modified 🔑 | TIMESTAMP |
Excluding source data
Inclusion and exclusion of source data in file storage integrations is done via specification of a folder path. The integration will sync all files under a certain folder path, even if they are themselves in nested subfolders of the specified folder. Excluding fields from source files is not currently supported.
Updating data
After the initial load of historical data, Fivetran only pulls incremental updates of any new or modified files from the source, adding an extra column to your tables called fivetran_synced (TIMESTAMP) that indicates the start time of the job that synced this row.
We do not recommend manually changing the contents of your files. Doing so will result in the following behaviours:
The integration has file-level granularity. If you modify a file, we update the table in the destination to match the contents of the file. Adding rows to a CSV that has already been synced will change the last_modified date, which will then trigger a re-sync of the contents of that file. The file name and line numbers will be used as primary keys. Whatever you change in your file will be represented in the file in the destination, but you may lose the previous version of the file that corresponded to the old record.
Frequency of updates
By default, all storage services sync new and modified files every 15 minutes. Depending on the size of each update or the number of tables, it may take longer. In that case, the integration will update at the next 15 minute interval, i.e.
-
Update X Start: 9:00am
-
Update X Finish: 9:18am
-
Update Y Start: 9:30am
You can change the update interval in the Dashboard. A storage service sync that encounters an error will re-try periodically after the shorter of the sync frequency or 1 hour.
Deleted data
We handle deleted data based on last modified dates, and we treat deleted files (and column) and deleted rows differently.
If you delete a file in your source bucket, it no longer exists, so it will not have a last modified date. Therefore, the deletion will not be reflected in your destination - so data from the deleted file will still remain in your destination.
Deleted columns will change the last modified date, but the deletions will not appear in your destination.
Deleted rows, on the other hand, will have a last modified date, so the change will be reflected in your destination.
Magic Folder connectorslink
We use the file name (without the extension) as the destination table name. For example, we sync a file named account_details.csv
as the ACCOUNT_DETAILS
table.
For spreadsheet files, we use a combination of the file name and worksheet name as the destination table name. For example, two worksheets called Sheet1
and Sheet2
in a spreadsheet My Workings
are synced as MY_WORKINGS_SHEET_1
and MY_WORKINGS_SHEET_2
tables. We use the values present in the first row of the worksheet as the column names in the destination table.
For more information about the schema and table naming rule set, see our naming conventions documentation.
After the first successful sync, you can view this mapping information in the Schema tab on your connector dashboard.
Sync strategy
Magic Folder connectors don’t support incremental syncs. We use the last modified date of the files to detect changes in the files of your cloud folder.
We do the following:
- If you add a new file to your cloud folder, we sync the file as a new table in your destination.
- If you modify a file in your cloud folder, we sync the file’s content again to the destination table. We delete the previous data of the table and don’t capture deletes.
- If you delete a file from your cloud folder, we don’t delete the table from your destination.
If we find files of the same name but with different extensions in the folder, we check the last modified dates of the files and sync only the least recently modified file. For example, if you add a file called abc.csv
in your cloud folder, and then add another file called abc.json
, we check the last modified date of both files and sync abc.csv
to your destination.
Primary keys
Fivetran adds a single column as a primary key for each table.
COLUMN | DATA TYPE |
---|---|
_line 🔑 | INT |
Sync limitations
We do not sync files inside nested folders in your cloud folder. We do not sync empty folders or unsupported file types.
We don’t sync empty worksheets. We don’t sync a worksheet if the entire first row of the worksheet is empty. We don’t sync a column if its first row is empty.
You can find more information on the individual connector pages.
File transfer connectorslink
File transfer connections occur at the table level. Each Fivetran connector you create connects to a single file directory, and its underlying data is loaded into a single destination table. Any files added to that specified directory will be pulled and loaded into the specified destination table.
You can configure multiple connectors such that they sync into a single schema. All file transfer connections are pull integrations – Fivetran periodically pulls new or changed data from the FTP or SSH server.
For more information, see the Sync overview section of our cloud-based storage connectors.
Email connectorlink
We extract the attachments from the email, parse the attachment data and upload them into your destination. For more information, see our Email connector documentation.
Google Sheets connectorlink
We connect to your Google Sheet, fetch the data from the designated named range, then create a matching table in your destination and load its corresponding initial data. We then continue to check and sync changes to the named range on the update frequency that you specify. For more information, see our Google Sheets connector documentation.
Supported file formatslink
File Format | Specification | Notes |
---|---|---|
Separated Value Files (CSV*, TSV, etc.) | RFC-4180 | |
JSON text files delimited by new lines | RFC-7159 | |
JSON Arrays | RFC-7159 | |
Avro | Apache Avro 1.8.2 | |
Parquet | Apache Parquet | |
Excel (XLS, XLSX, and XLSM) | Microsoft Excel | Magic Folder connectors. |
Google Sheets | Google Sheets | Google Drive and Google Sheets connectors. |
IMPORTANT: Use the Google Sheets connector to sync data from a specific named range in your file to a single destination table. Use the Google Drive connector to sync data from multiple sheets within a spreadsheet as unique destination tables.
Supported file compressionlink
-
TAR and ZIP archives
-
BZip2 and GZip compression
NOTE: The Magic Folder connectors don’t support file compression. We don’t sync compressed files to your destination.
Supported encodingslink
- UTF-8, UTF-16, and UTF-32, with big or little endian order
- UTF-8 encoding is assumed if no Byte-Order Mark is present at the beginning of a file
Syncing empty tables and columnslink
The cloud-based storage and file transfer connectors don’t support the creation of empty columns in your destination. We create a column in the destination table only if the column in your source file is not empty.
The Magic Folder connectors don’t support the creation of empty tables and columns in your destination. We create a column in the destination table only if the column in your source file is not empty.
NOTE: For spreadsheet files, we don’t create a destination table if the worksheet is empty. We don’t create a table if the entire first row of the worksheet is empty. We create a column only if its first row is not empty.
The Google Sheets connector doesn’t support the creation of empty tables and columns in your destination. We don’t create a destination table if the Google sheet is empty. We create a column in the destination table only if the column in your source file is not empty.
The Email connector doesn’t support the creation of empty columns in your destination.
Configuration optionslink
IMPORTANT: The following configuration options are applicable only for our cloud-based storage and file transfer connectors.
Using these configuration options, you can select subsets of your folders, certain types of files, and more to sync only the files you need in your destination. Setting up multiple connectors targeted at the same source, but with different options, can allow you to slice and dice a source any way you’d like.
Folder path (optional)
This folder path is used to specify a portion of the bucket in which you’d like Fivetran to look for files. Any files under the specified folder and all of its nested subfolders will be examined for files we can upload. If no prefix is supplied, we’ll look through the entire bucket for files to sync.
File pattern (optional)
The file pattern is a regular expression that we use to decide whether or not to sync certain files. It applies to everything under the prefix. For instance, suppose under the prefix logs
you had three folders: 2017
, 2016
, and errors
. Using the pattern \d\d\d\d/.*
, you could exclude all the files in the errors
folder, because \d\d\d\d
only applies to the folders whose name consists of four consecutive digits, and because .*
after /
applies to any files in these folders. If you’re not sure what regular expression to use, you can leave this field blank, and we’ll sync everything under the prefix. If you’re feeling particularly bold, you can learn to write your own regex using Tutorialspoint’s Java - Regular Expressions documentation and test it out using the Rubular tool.
File type
The file type is used to let Fivetran know that even files without a file extension ought to be parsed as this file type. For example, if you have an automated CSV output system that saves files without a .csv extension, you can specify the CSV type and we will sync them correctly as CSVs. Selecting “infer” will let Fivetran infer from a file’s extension (.csv
, .tsv
, .json
, .avro
, or .log
) what to sync. If you do choose a file type, every file we examine will be interpreted as the file type you select, so make sure everything Fivetran syncs has the same file type!
Compression
The compression format is used to let Fivetran know that even files without a compression extension should be decompressed using the selected compression format. For example, if you have an automated CSV output system that GZIPs files to save space, but saves them without a .gzip extension, you can set this field to GZIP. The integration will then decompress every file that it examines using GZIP. If all of your compressed files are correctly marked with a matching compression extension (.bz2
, .gz
, .gzip
, .tar
, or .zip
), you can select “infer”.
Error handling
Selecting skip ignores any improperly formatted data within a file, allowing you to sync only valid data. Choosing fail enables you to prevent a file from syncing if any improperly formatted data is detected. With either option you will receive a notification on your dashboard if errors are encountered.
Advanced optionslink
Use the advanced configuration options for highly specific cases.
Modified file merge
When a previously synced file is modified, should the rows in the destination be replaced or should the new rows be appended to the table. upsert_file
option will replace records in destination, using the filename and line number as the primary key. append_file
option will append records.
NOTE: Select the
upsert_file
option to replicate the file contents to the destination. Select theappend_file
option to track the file modification history.
Archive folder pattern (optional)
If there are multiple files within archive (TAR or ZIP) folders, you can use the archive folder pattern to filter those as well. For example, the archive folder pattern .*json
will sync from an archive folder only those files that end in a .json file extension.
Null sequence (optional)
CSVs have no native notion of a null character. However, some CSV generators have created one, using characters such as \N
to represent null. Note: text is un-escaped before the null sequence is matched, so don’t use the escape character in your null sequence. Only use this field if you are sure your CSVs have a null sequence.
Delimiter (optional)
The delimiter is a character used in CSV files to separate one field from the next. If this is left blank, Fivetran will infer the delimiter for each file, and files of many different types of delimiters can be stored in the same folder with no problems. If this is not left blank, then all CSV files in your search path will be parsed with this delimiter.
Escape character (optional)
CSVs have a special rule for escaping quotation marks as opposed to other characters - they require two consecutive double quotes to represent an escaped double quote. However, some CSV generators do not follow this rule and use other characters like backslash for escaping. Only use this field if you are sure your CSVs have a different escape character.
Skip header lines (optional)
Some CSV generating programs include additional header lines at the top of the file. They consist of few lines that do not match the format of the rest of the rows in the file. These header rows can cause undesired behavior in Fivetran because we attempt to parse them as if they were records in your CSV. By setting this value, you can skip fixed-length headers at the beginning of your CSV files.
Note: Only use this field if you are sure your CSVs have more than one header line. We will skip these lines before we map the header to row data for the CSVs.
Skip footer lines (optional)
Some CSV generating programs include a footer at the bottom of the file. It consists of a few lines that do not match the format of the rest of the rows in the file. These footer rows can cause undesired behavior in Fivetran because we attempt to parse them as if they were records in your CSV. By setting this value, you can skip fixed-length footers at the end of your CSV files.
Headerless files (optional)
Some CSV generating programs do not include column name headers for the files — they only contain data rows. By setting this value, you request Fivetran to generate generic column names following the convention of column_0
, column_1
, … column_n
to map the rows.
Note: Only use this option if you are sure your CSVs do not have the header line, and the column orderings remain the same. Otherwise, it can cause undesired behavior in the schema. For example, if the column order changes in the source, we won’t be able to identify column changes. If you have no control of the CSV generator and still want to turn on the empty file option, we recommend always keeping the error handling option “on” to catch potential errors.