-3

have looked serveral days now to find a Possibility to save data from my MySQL Database to a local file (on the client PC not the server) to analyze the Data there. I have tried the standard file out node but that only saves to the server File system.

the Flow i am currently using is like this:

current flow

If the Button is clicked the data collected by the Function node is send to the Template node.

The last approach i have found some minutes ago was this: Data URI, but I dont get how to put my msg.payload to the file content.
Sorry for this dumb questions but im barely new to HTML and using it in node-red.

Thanks in advance.

hardillb
  • 54,545
  • 11
  • 67
  • 105
manni
  • 5
  • 1
  • 5
  • Are you trying to build a JS app or are only want to create backups of some database on your local machine? Please clarify your goals and ask questions with only one topic per question. For example: most MySQL databases are not accessibly from outside a hosting-companies network for security reasons. That might be a reason, why you can dump a backup on the server, but not on you local machine. Please check your connection. If the question on the other hand is about how to display a line break in a UI dialog, please remove any other parts from the question… – feeela Dec 12 '17 at 09:06
  • The reason for doing this is to get an easy way to analyze the data on a local machine. I asked for both ways because I would prefer the download one over the copy paste approach but it would be ok if one way doesn't work – manni Dec 12 '17 at 09:12
  • If you just want to browse a database or do some example queries for non-regular statistic evaluations you can use a UI tool like [MySQL Workbench](https://www.mysql.com/products/workbench/), which may also connect to the server via SSH and thus avoid the limitation of most MySQL databases not being accessible from another network. Please refer to their documentation too. – feeela Dec 12 '17 at 09:19
  • Yeah for me it would be an easy way to use Workbench, but I have to publish all that to people with no afford of learning MySQL wich can only load the data with their tools, that ist my big problem. With node-red they could click through my mask and get the right data on the computer. The constrain with one user per time is the only downside then. – manni Dec 12 '17 at 09:46
  • Edit the question to show us what you have already tried, then we may be able to help you fix it – hardillb Dec 12 '17 at 09:50

1 Answers1

2

Use the http-in and http-out nodes to create a HTTP endpoint that will return the data you want.

If you wire the output from the http-in to the input of the database node then the output from the function node to the input on the http-out.

You can then just point your browser at the URL you configure in the http-in node and the browser should download the data so you can save it locally. You may need to set the Content-Type header to make sure the browser does the right thing with the data.

hardillb
  • 54,545
  • 11
  • 67
  • 105