Parquet Drill end of line - apache-drill

I have conveted a text file on a parquet file using Drill on a Windows env. It worked fine but when I read the parquet files on a linux env using RStudio the last column show the windows end of line(\r). How can I fix it?

I had a similar issue and used REGEXP:
SELECT
CAST(REGEXP_REPLACE(`mycolumn`, '\R', '') AS VARCHAR) AS `mycolumn`
etc
Which solved the issue.

Related

Importing CSV to MonetDB

I am new for using MonetDB. I have imported .csv file in it.
However there are always the problem :
sql>COPY INTO 123 FROM' C:\Program Files\MonetDB\112.csv' USING DELIMITERS '|', '|\n' LOCKED;
COPY INTO: filename must have absolute path: C:\Program Files\MonetDB\112.csv
OR It display another question :
sql>COPY INTO usgs FROM 'C:\Program Files\MonetDB\112.csv' USING DELIMITERS '|', '|\n' LOCKED;
Failed to import table '123', incomplete record at end of file
I do not konw how to solve it?
Try using delimiters '|', '\n', ''. Here discussion of this problem
I have faced the similar issue a while ago when I was working on case-study. I have to resolve it via Pentaho ETL tool which ships with MonetDB BulkLoader.
I'm not sure that's how you want the stuff to run but for me it worked and it was fast as well.
Please refer to the article - https://medium.com/dataengineering-and-algorithms/the-use-of-column-store-database-for-data-warehousing-fcf8d3e1941c
Coming back to your question did you try changing the slash to '/' in the path.

My schema.ini file is being ignored when using DoCmd.TransferText() from .Net

My schema.ini file is being ignored.I get the same results whether I have a scheme.ini file in the same folder as my tab file or not. All of the columns end up in a single column. I am trying to use a schema.ini as I am importing tab delimited files. The results make perfect sense if it is trying to import a comma delim file.
So my postulate is that the schema.ini file is just being ignored.
I am running Access from a .Net program using Microsoft Access 14.0 Object.Library.
I am using this command from .net:
Access.DoCmd.TransferText( Microsoft.Office.Interop.Access.AcTextTransferType.acImportDelim, , TableName, TabFile, HasFieldNames)
Here is my schema.ini file, not that it matters since it is being completely ignored:
[impacts.txt]
Format=TabDelimited
ColNameHeader=True
MaxScanRows=0
Clues? Thanks!
EDIT:
I tried running this from within an Access Module with the same results.
I tried editing the registry to change the Format value there. Same results.
Consider an action query, either append or make-table, as the use of schema.ini files can work directly in an Access query of a text file. Below assumes .ini file is in same directory as text file.
INSERT INTO mytableName
SELECT * FROM [text;Database=C:\Path\To\Text\File].[impacts.txt]
SELECT * INTO newtableName FROM [text;Database=C:\Path\To\Text\File].[impacts.txt]

I can't find my MySQL folder in %ProgramData%

First of all, I just want to say that I'm new to SQL, so forgive me if I'm being ignorant or something.
I'm working on this project and I need to import data from a text file. My first thought was to use this command:
LOAD DATA LOCAL INFILE '/tmp/test.txt' INTO TABLE names;
Where my text file is test and my table is names.
However, I got this error message:
Error Code: 2. File '\tmp\teste.txt' not found (Errcode: 2 - No such file or directory)
I tried to save this file in the tmp folder but I still got this same error. I was told that maybe the problem is in my.ini (something about the --secure-file-priv) but I just can't find my MySQL folder in C:\ProgramData. Apparently, that is where my.ini is supposed to be. So, any ideas of what is going on?
By the way, I'm not confusing C:\Program Files and C:\ProgramData
P.S: I use Windows 10 and MySQL Workbench 6.3 CE.
Alright pals, the problem is solved. I honestly don't know how I managed to find the problem but I did and as expected, it was a silly one. The correct statement would be:
load data infile 'c:\\wamp\\tmp\\test.txt' into table names;
I got confused with all that slashes thing, because for directories you use \ or /. So my mistake was doing this:
load data infile 'c:\wamp\tmp\test.txt' into table names;
Using only one backslash instead of two, which is wrong. Finally, I just needed to put my text file in the tmp folder and use the appropriate backslashes (no need for LOCAL). Thanks for the help!

MySQL LOAD DATA Error (Errcode: 2 - "No such file or directory")

I am trying to load data into a table of my MySQL database, and getting this error.
LOAD DATA LOCAL INFILE 'C:\Users\Myself\Desktop\Blah Blah\LOAD DATA\week.txt'
INTO TABLE week;
Reference: this
The path is hundred percent correct, I copied it by pressing shift and clicking "copy path as" and checked it many times. So any tips on this will be much appreciated.
.
My research: Seeing this answer, I tried by changing C:\Users to C:\\Users. It did not work for me.
Secondly, is there a way to use some kind of a relative path (rather than an absolute path) here?
I spent 2 days on this and finally got my mistake, Just changing backslashes by forward ones, as one contributor previously said. And finally worked for me.
so was:
LOAD DATA LOCAL INFILE 'C:/ProgramData/MySQL/MySQL Server 5.7/Data/menagerie/pet.txt' INTO TABLE pet;
I just can say thanks a lot.
p.s. don't waste time on ytb...
I don't know what version of MySQL you are using but a quick Google search found possible answers to both your questions. Below are excerpts from the MySQL 5.1 Reference Manual:
The file name must be given as a literal string. On Windows, specify
backslashes in path names as forward slashes or doubled backslashes
The LOCAL keyword affects where the file is expected to be found:
If LOCAL is specified, the file is read by the client program on the
client host and sent to the server. The file can be given as a full
path name to specify its exact location. If given as a relative path
name, the name is interpreted relative to the directory in which the
client program was started.
Regards.
If using MySQL Workbench on a local Windows PC to connect to a remote MySQL server,
Add the "LOCAL" keyword
Add double backslashes "\\" to your folder path
If text file's first row has column names add "IGNORE 1 LINES".
LOAD DATA LOCAL INFILE 'C:\\MyTabDelimited.txt'
INTO TABLE my_table IGNORE 1 LINES;
Simply replace backslash with slash in the path.
This works for me (MySQL Workbench 6.3 on Win 10):
LOAD DATA LOCAL INFILE 'C:/Users/Myself/Desktop/Blah Blah/LOAD DATA/week.txt'
INTO TABLE week;
Ref. https://dev.mysql.com/doc/refman/5.5/en/loading-tables.html
One more reason for this type of error is another languge in the path.
You might have almost the entire path in English, but the username might be auto-filled in another language.
Try removing the word LOCAL from your query.
Try moving the week.txt file to the desktop
then execute in a terminal window:
LOAD DATA LOCAL INFILE 'C:\Users\Myself\Desktop\week.txt'
INTO TABLE week;
Instead of using double backslash That slash is also worked for me too.
I resolve this problem by replacing the path
Replace format "C:\Users\Myself\Desktop\week.txt"
With this different format "C:/Users/Myself/Desktop/week.txt"
My computer didnt recognize the ( \ ) symbols.

load data local infile ERROR 2 file not found

I've been ramming my face against this sql error for about 45 minutes, and I have a feeling it's going to be something silly.
I'm trying to load a .txt file into my database, which is on a server elsewhere. I'm using putty on windows 7.
The sql call I am using is the following:
LOAD DATA LOCAL INFILE "C:/Users/Sam/Desktop/students_data.txt" INTO TABLE students;
The response I get is ERROR 2 (HYOOO): File 'C:/Users/Sam/Desktop/students_data.txt' not found (Errcode:2)
If anyone could shed some light on this that'd be extravagant. I already tried switching the / to \ and using single quotes, etc., but nothing seems to work. The file path is copied by shift+clicking the actual file and pasting it.
I have found a solution. First delete the word LOCAL from the sql statement. Second - place your file into MySQL DATA folder usually - bin/mysql/msql5.5.8/data/and your DB with which you are working. It worked for me. You might want to check your MAX_FILE upload number in php.ini file if file is large.
Removing the word LOCAL seemed to work for me; try it out!
Try to type path as C:\\mydir\\myfile.csv i.e. use \\ instead of \
I had this problem too, then I read this:
The file name must be given as a literal string. On Windows, specify
backslashes in path names as forward slashes or doubled backslashes
(from http://dev.mysql.com/doc/refman/5.1/en/load-data.html)
I did use the LOCAL keyword, but escaped the file path like this: str_replace('\\','/',$file), then it worked like a charm!
Had this too and solved it by using cmd.exe and found that the filename was mistakenly in the form filename.txt.txt and fixed it.
just replace "\" by "/" as the path directory before the filename.txt in (""). it will be better if u just keep the file in mysql data folder and do the thing i mentioned above.it will definitely work.
Sorry my previous answer is wrong.
In my case, I connect to a proxy, not the real physical mysql instance, so of course it could not get my local file.
To solve this, figure out the true physical mysql instance IP, connect it directly. You need help from the DBA.
LOAD DATA LOCAL INFILE 'C:\\cygwin\\home\\jml58z\\e_npv\\Fn_awk2010.mysql' INTO TABLE mydata
with the double \ it worked