Comments (3)
I don't think the CSV Agent works the way you want it to.
When using the serialise function it takes in multiple events and combines them into a single CSV format. It doesn't remap objects from a single JSON to a single CSV and it doesn't actually create files.
Example:
Send the following two separate events:
{ "key": "1707838936", "title": "foo", "price": "111" }
{ "key": "1707849865", "title": "bar", "price": "222" }
With default CSV Agent options + "mode": "serialize"
and "data_path": "$"
This will result in the payload:
{
"data": "\"key\",\"title\",\"price\"\n\"1707838936\",\"foo\",\"111\"\n\"1707849865\",\"bar\",\"222\"\n"
}
I you then send that event to the Local File Agent it will write it to disk as:
"key","title","price"
"1707838936","foo","111"
"1707849865","bar","222"
from huginn.
I wanted to send it to an FTP Agent, not Local File Agent. However the FTP Agent writes a nonsense CSV File.
Does that mean the CSV Agent absolutely needs the local file Agent to translate the serialized string into an actual CSV compliant File? FTP Agent can't do it aparently.
Also, I can't send separate events to the CSV Agent because I want to read data from a Key Value Store Agent and then send it as one event containing all the data.
Essentially what I want is: Several Agents send Events to the Key Value Store Agent. At certain intervals the collected Data is written into a CSV File and published to an FTP.
As a workaround I currently just publish a JSON File, which works with the current agent setup.
from huginn.
The CSV agent just creates an event with a json name value pair, which contains just a string of characters in it. It doesn't matter whether you send it to the Local File Agent or the Ftpsite Agent (or any other agent), and just writes the data to file. There is no further "translation" happening.
Previous example (escaped JSON event):
{ "data": "\"key\",\"title\",\"price\"\n\"1707838936\",\"foo\",\"111\"\n\"1707849865\",\"bar\",\"222\"\n" }
When writing the content of "data" that would be:
"key","title","price"\n"1707838936","foo","111"\n"1707849865","bar","222"
Which is the same as
"key","title","price"
"1707838936","foo","111"
"1707849865","bar","222"
Which is a valid CSV file.
from huginn.
Related Issues (20)
- How to use Key Value Store Agent? HOT 5
- Deployment on Heroku fails because heroku-18 stack is gone HOT 1
- Process incoming email from ImapFolderAgent (extract multiple instances from body text) HOT 1
- I have 2 cookie credentials. How to randomly select a cookie HOT 2
- Kubernetes deployment
- Multiple RAW files with dcraw don't work HOT 3
- Multiprocess Docker image creation for GHCR fails
- Help with website agent: Extract emails when Xpaths are different
- Can the Post Agent emit event only when changed? HOT 2
- Javascript Agent JSON.parse is throwing an exception, but the same string can be parsed correctly in the browser HOT 2
- Cannot retrieve data from key value store agent HOT 12
- Docker: Failed to register layer HOT 2
- Agent to detect changes in local folder HOT 1
- LocalFileAgent not detecting files
- How to set regexp flags? HOT 4
- Website agent refuses to create event if extraction is empty HOT 1
- POST Agent sending token invalid
- DataOutput Agent ... Output feed lifetime / timeout? HOT 3
- Configure secure SMTP HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from huginn.