SSIS adding XML to a fixed width flat file - ssis

I have a package that looks for new files and parses them into their respective tables. Since the filenames include a date, I have to search for a specific string that identifies the file instead of using a static filename. Everything works, except for that using this dynamic method of finding the file seems to be adding a ton of XML formatting to the file, which is then being inserted as records into the database. When I point the flat file connection manager at file directly using it's name, this problem does not happen. Any ideas?

Related

How to rename a file, using exiftool, to a new name contained in CSV import file

Using exiftool, I have exported image file data to a CSV file. I have manipulated that data and now I want to import the new values to the original files. Everything works as I would expect, except that I want also to rename images to new file names contained in the CSV file (those new names were generated manually as well as by programs; they could not be generated by a rule). I know how to rename files using data that is in the source image file (e.g. I've found advice on how to incorporate the camera model name into the file name), but I don't know how to rename the source image file to the name that I have specified in the CSV file.
It would be simple enough to do this renaming separately from exiftool, but I'm curious to know whether exiftool can do it. It seems to be able to do pretty much anything else.
According to this thread, Phil Harvey (creator of exiftool) says it isn't possible to rename files from a CSV file. It's "a feature to prevent people from messing up their files unintentionally."

Open up SSIS Package as an XML or Raw File

I want to open a ".dtsx" file as a raw file or an xml file (doesn't matter which). Is this possible in SSIS? Not from what I can tell, but I wanted to see if someone else has run into this before.
Edit #1:
My ultimate goal is not to view the xml, but to import the xml in all the packages as text data and search the xml that way. I have about 200-300 packages to search.
To view the XML of your package right click the package and select View Code from within SSDT. This will open the XML for it.
I would take copies of all the packages you want to search and put them in their own folder. Create a Foreach File Loop container, point it to your folder, and give it *.dtsx as the file wildcard. Make sure you set a variable to capture the fully qualified path to the file.
Inside the Foreach Loop, use your path variable as the connection string to a Flat File Connection. Configure the Flat File Connection with Ragged Right as the Format and with Tab as the row delimiter. You should get a single row with a single column. In the Advanced tab of the Flat File Connection Manager, set the DataType to Unicode text stream.
You now have the raw text as an NTEXT field. If you import this into an NVARCHAR(MAX) field in a db table, you'll be able to use SQL's xml processing, which I believe is what you're trying to achieve.

Import csv with paths to pdf files

I have a custom content type (product) containing a title, some text and a file (a pdf file).
A lot of products have to be imported to the Drupal CMS. I discovered the plugin "Feeds" which seems to fulfill my requirements.
I managed to import a csv files containing a title and some text.
Now in my csv file I have a column containing a path to all the pdf files (like C:\mypdfs\product1.pdf). How can I manage that those pdf files are imported by Feeds? In "Mapping" configuration I'm not sure what target I have to select for those column which contains the path to a local file.
Using Feeds Tamper module you can manipulate the value of imported data for one target. Here you can build a custom tamper (See How) and use it to process the retrieved value (file path), using file_get_contents to get the file from imported path and file_save_data to save a file in Drupal, getting a field object that you can attach to an entity (this could help).

Adding static files to Talend jobs

I'm using Talend Open Studio for Big Data and I have a job where I use tFileInputDelimited to load a CSV file and use it as a lookup with a tMap.
Currently the file is loaded from the disk using an absolute path (C:\work\jobs\lookup.csv) and everything works fine locally.
The issue is that when I deploy the task, it obviously doesn't take the lookup.csv file with it.
Which begs a question:
Is there any way to "bundle" this file (lookup.csv) into the job so I can later deploy them together?
With static data such as this your best bet is to hard code the data into the job using a tFixedFlowInput instead.
As an example, if we want to use a list of country names, their ISO2 and ISO3 codes you might have these in a CSV that you'd normally access with a tFileInputDelimited. However, to save bundling this CSV with every build (which could be done with ANT/Maven) you can just hard code this data into a tFixedFlowInput:
You then just need to make sure your schema is set up as the same as your delimited file would have been (so in this case we have 3 columns: Country_Name, ISO2 and ISO3).

Creating a CSV file with the Report Generation Toolkit in Labview

I want to create .csv files with the Report Generation Toolkit in Labview.
They must actually be .csv files which can be opened with Notepad or something similar.
Creating a .csv is not that hard, it's just a matter of adding the extension to the file name that's going to be created.
If I create a .csv file this way it opens nicely in excel just the way it should, but if I open it in Notepad it shows all kind of characters and it doesn't even come close to the data I wrote to the file.
I create the files with the Labview code below:
Link to image (can't post image yet because I've got to few points)
I know .csv files can be created with the Write to Spreadsheet VI but I would like to use the Report Generation Toolkit because it's pretty easy to add columns and rows to the file and that is something I really need.
you can use the Robust CSV package on the lavag.org forum to read and write 2D arrays to CSV files.
http://lavag.org/files/file/239-robust-csv/
Calling a file "csv" does not make it a CSV file. I never used the toolkit to generate an Excel file, but I'm assuming it creates an XLS or XLSX file, regardless of what extension you give it, which is why you're seeing gibberish (probably XLS, since it's been around for a while and I believe XLSX is XML, not binary).
I'm not sure what your problem is with the write spreadsheet VI. It has an append input, so I assume you can use that to at least add rows directly to a file, although I can't say I ever tried it. I would prefer handling all the data in memory explicitly, where you can easily use the array functions to add rows or columns to the array and then overwrite the entire file.