# Display Data from MySQL without uibuilder

**URL:** <https://discourse.nodered.org/t/display-data-from-mysql-without-uibuilder/44107>\
**Category:** General\
**Created:** [13 April 2021 13:31 UTC](https://discourse.nodered.org/t/display-data-from-mysql-without-uibuilder/44107 "2021-04-13T13:31:40Z")\
**Posts on this page:** 8\
**Page:** 2

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [14 April 2021 19:27 UTC](https://discourse.nodered.org/t/display-data-from-mysql-without-uibuilder/44107/21 "2021-04-14T19:27:32Z")

</div>

The generic file read nodes in Node-RED do not, I believe care about individual lines, they just read the whole file.

I don't think the node.js fs library will pull an individual line either. However, there are certainly node.js packages that will probably do what you want - `linereader` for example? Look on [npmjs.org](http://npmjs.org).

---

<div class="post-metadata">

**Author:** ![ChZeman](https://avatars.discourse-cdn.com/v4/letter/c/76d3ee/32.png) [@ChZeman](https://discourse.nodered.org/u/ChZeman)\
**Post date:** [14 April 2021 20:17 UTC](https://discourse.nodered.org/t/display-data-from-mysql-without-uibuilder/44107/22 "2021-04-14T20:17:47Z")

</div>

I was looking at linereader earlier. It looks like it will do what I want, but how to use it in Node Red is documentation that's missing. What they show on [npmjs.org](http://npmjs.org) doesn't work. This doesn't work, either: [https://stackabuse.com/reading-a-file-line-by-line-in-node-js/](https://stackabuse.com/reading-a-file-line-by-line-in-node-js/)

Time for me to clock out for the day and go home. I'll go back to pulling what little of my hair I have left out tomorrow.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [14 April 2021 20:33 UTC](https://discourse.nodered.org/t/display-data-from-mysql-without-uibuilder/44107/23 "2021-04-14T20:33:44Z")

</div>

[This section](https://nodered.org/docs/user-guide/writing-functions#loading-additional-modules) of the Writing Functions page tells you how you can use the new FunctionExternalModules feature to pull in external code to use in a Function node.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [14 April 2021 20:47 UTC](https://discourse.nodered.org/t/display-data-from-mysql-without-uibuilder/44107/24 "2021-04-14T20:47:06Z")

</div>

Most of that looks like it will work to me.

---

<div class="post-metadata">

**Author:** ![ChZeman](https://avatars.discourse-cdn.com/v4/letter/c/76d3ee/32.png) [@ChZeman](https://discourse.nodered.org/u/ChZeman)\
**Post date:** [14 April 2021 21:46 UTC](https://discourse.nodered.org/t/display-data-from-mysql-without-uibuilder/44107/25 "2021-04-14T21:46:29Z")

</div>

It does, but then I get errors for "require" not being defined and stuff like that.

I'll play with it again on Saturday when I go back to work. I'll probably end up just writing and calling a Python script to get the data I need. I'd have been done with this a long time ago had I done that in the first place.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [14 April 2021 23:13 UTC](https://discourse.nodered.org/t/display-data-from-mysql-without-uibuilder/44107/26 "2021-04-14T23:13:37Z")

</div>

You can add require to the globals using the settings.js file. Then you can do a global.get('require') at the top of your function node.

Of course, as colin points out, you can require things in function nodes without going through that now if you are using the latest version of Node-RED.

---

<div class="post-metadata">

**Author:** ![ChZeman](https://avatars.discourse-cdn.com/v4/letter/c/76d3ee/32.png) [@ChZeman](https://discourse.nodered.org/u/ChZeman)\
**Post date:** [18 April 2021 16:21 UTC](https://discourse.nodered.org/t/display-data-from-mysql-without-uibuilder/44107/27 "2021-04-18T16:21:22Z")

</div>

I got it doing what I needed using python3-function. It was far more straightforward than Javascript.

Thank you for the help! This problem is resolved.

Chris

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [2 May 2021 16:22 UTC](https://discourse.nodered.org/t/display-data-from-mysql-without-uibuilder/44107/28 "2021-05-02T16:22:12Z")

</div>

Closed on 2 May 2021 16:22 UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

[Previous page](https://discourse.nodered.org/t/display-data-from-mysql-without-uibuilder/44107.md?page=1)
