[MDEV-9714] Connect CSV file sep_char option Created: 2016-03-11 Updated: 2016-03-16 Resolved: 2016-03-12 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - Connect |
| Affects Version/s: | 10.1 |
| Fix Version/s: | 10.0.25, 10.1.14 |
| Type: | Bug | Priority: | Major |
| Reporter: | Btissam | Assignee: | Olivier Bertrand |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Windows |
||
| Description |
|
Hi, I have a file with separators "(#]" I need to load it ,using CONNECT engine:
It gives :
Is there any way to load this kind of file? Thanks for help. Regards |
| Comments |
| Comment by Elena Stepanova [ 2016-03-12 ] | |||||
|
From the documentation it looks like sep_char is supposed to be 1 symbol, but it's not said so explicitly. Besides, if it's so, it would make more sense to produce an error upon table creation, not upon SELECT. | |||||
| Comment by Btissam [ 2016-03-12 ] | |||||
|
I got the error from the Select statement | |||||
| Comment by Olivier Bertrand [ 2016-03-12 ] | |||||
|
Your file is not a CSV file. CSV files have a one character separator as said in the MariaDB documentation: Many source data files are formatted with variable length fields and records. The simplest format, known as CSV (Comma Separated Variables), has column fields separated by a separator character. By default, the separator is a comma but can be specified by the SEP_CHAR option as any character, for instance a semi-colon. I agree that this should be checked when creating the table and will fix it as soon as possible. Meanwhile you can create and load your table as a FMT table:
Note that FMT being read only tables, this enables you to load and use the table but not to modify it. | |||||
| Comment by Btissam [ 2016-03-12 ] | |||||
|
Thanks a lot it works perfectly I need to index this table (let say on name) to load data fast , how to do it using this command? (I have a file that can reach 1Million records..). Many Thanks | |||||
| Comment by Olivier Bertrand [ 2016-03-12 ] | |||||
|
Like for any table. You can define name as key or simply execute:
| |||||
| Comment by Btissam [ 2016-03-14 ] | |||||
|
Thanks a lot for your feedback! |