How to format CSV file for importing multiple files to Google Cloud AutoML Translate? - google-cloud-automl

I am trying to use the Python Client Library to add multiple files to a dataset I have created for AutoMl Translate. I was unable to find a good example for the csv file that is to be used. Here is the link to their Python Client Library example code to add files to a dataset.
I have created a csv in a bucket of the following form:
UNASSIGNED,gs://<bucket name>/x,gs://<bucket name>/y
Where I am trying to add two files called x and y.
and I get the following error:
google.api_core.exceptions.GoogleAPICallError: None No files to import. Please specify your input files.

The problem was how I formatted the csv file. Each file I want to add needs to have its own line,
The correct csv file would look like this:
UNASSIGNED,gs://<bucket name>/x
UNASSIGNED,gs://<bucket name>/y

Related

Write header line for empty CSVs using Apache Nifis "CsvRecordSetWriter" Controller and "ConvertRecord" Processor

I'm using NiFi 1.11.4 to read CSV files from an SFTP, do a few transformations and then drop them off on GCS. Some of the files contain no content, only a header line. During my transformations I convert the files to the AVRO format, but when converting back to CSV no file output is produced for the files where the content is empty.
I have the following settings for the Processor:
And for the Controller:
I did find the following topic: How to use ConvertRecord and CSVRecordSetWriter to output header (with no data) in Apache NiFi? but in the comments it mentions explicitly that ConvertRecord should cover this since 1.8. Sadly I understood it incorrectly, it does not seem to work or my setup is wrong.
While I could make it work with by explicitly writing the schema as a line to empty files, I wanted to know if there is also a more elegant way?

Gnuplot, how to plot data from a file .dat (No data in plot problem)

I am using Gnuplot on windows 10, I need to plot some file excel and to do that I copied and pasted evrything in a .dat file (ANSI), but everytime I try to do a simple plot (I mean the only "plot" command) I have this " warning: Cannot find or open file "FolderWhereFileIsLocated/filetoplot.dat"
No data in plot
And of course it is not empty, the file contains this: enter image description here
The file is saved as a .dat , I've also checked many questions about issues like this but I did not have solved, I've also tried to download from the web some other .dat files to test them but without any results.
Can someone please explain me step by step what can I do to make Gnuplot plot my .dat files?
Thanks in advance.
You should take care that your columns are properly separated. In the image you attached are a bunch of white spaces and then a comma separated pair of values, or do you use the comma as decimal symbol?
Save the spreadsheet directly using excel (eg. as csv type and name it *.dat if you want to have it ending like this) and then try to plot it once more.

ruby excel - write data to existing xls

I have tried different gems in ruby and also searched a lot but Ruby doesnt seem to have a solution to write to existing excel file.
my excel file 'services.xls' has 3 columns
1st column name is 'inputxlm'
2nd column name is 'methodtoexecute'
3rd column name is 'output'
i have internal logic which takes the inputxlm, process it using the method and generates output
How do i write back the output to output column in 'services.xls' ?
Note : I dont want to use win32ole as my organization has some limitation on it
This article is a great source to find out which library suits you best: https://spin.atomicobject.com/2017/03/22/parsing-excel-files-ruby/
My company uses axlsx combined with axlsx_rails to render xls files with Rails rendering machine and axlsx_styler for styling.
Note that in a simple use case like the one you describe, you night not need an excel file like xls, a mere CSV would suffice, and for that, Ruby has CSV

ESQL code for CSV to XML conversion in IIB v10

I want to convert input CSV file to XML file using ESQL in IIB v10. Can you please help me with the ESQL code to achieve the same. I've provided the Input CSV file sample and Output XML file sample as below:
Input CSV file
Output XML file
Your question is fundamentally wrong. Using ESQL only to do it on Integration Bus is like using a knife to cut down a tree (when you have the choice with a chainsaw). If you want to convert a csv file to an xml, the proper solution is the following :
1) Define a new DFDL schema to parse the CSV file
2) Define your xsd for the output XML
3) Use the DFDL parser when you read the CSV, and use the structure you created (on the fileInput node for example, I don't know your exact case)
4) Use a mapping node to map from your DFDL structure to your XML structure (defined in the xsd)
Note : the last step can be done with alternatives solution, like compute Nodes (ESQL, Java, C#, php).
If you have any additional questions, feel free to contact me

How to transfer files in order (first come first serve) using apache camel

In my code there are two types of files with extension .csv or .psv and .tigger files. .csv files have more size than .trigger files, so .trigger files are getting transfer in prior to .csv files.
How to make sure that once .csv files are transferred only .trigger files should be transferred.
Am using same single route to transfer both the files.
You can use the sortBy-option of the camel file component. See http://camel.apache.org/file2.html for more information.
One idea is to implement camel's org.apache.camel.component.file.GenericFileFilter and write your filter logic in accept method. Logic should pick all the csv files first and then the trigger files. Use filter option of file component, from end point will be like:
from("file://inbox?filter=myFilter")

Resources