The CSV driver is capable of loading CSV files into the InMemory Database.
Connection String Parameters:
Keyword |
Value |
Description |
HasHeaders |
true/false |
Flag for whether the file has a header as the first row or not. |
loadasstring |
true/false |
Flag for the driver to perceive all rows as being strings and thereby not interpreting data types |
type |
local/url |
Use 'local' if the file is placed on the local file system. The driver also supports retrieving data from a regular URL without password protections |
delimiter |
; |
Sets the delimiter character. The string quotes are automatically detected |
encoding |
Windows-1252 |
Determines the character set. The encoding specified must be in the list of encodings available in the .NET API |
Query parameters:
Retrieving the data from the file is done by performing a SELECT command, e.g.
SELECT * FROM [sample_csv_file.csv]
The driver does not support retrieving individual columns. If this is required the solution is to load the data into another table after the import finishes.
Example:
LOAD ASSEMBLY 'TARGIT.Csv.dll'
DATASOURCE [CSV] = DOTNET CONNECTION 'TARGIT.CSV.CsvConnection'
'HasHeaders=true;loadasstring=true;type=local;delimiter=;;encoding=Windows-1252;'
IMPORT [BudgetData] = [CSV].{SELECT * FROM [C:\DEMODATA\BUDGETDATA.CSV]}
Comments
Please sign in to leave a comment.