# Exporting all Logic variables to MySQL?

**URL:** <https://community.homey.app/t/exporting-all-logic-variables-to-mysql/76182>\
**Category:** Questions & Help\
**Tags:** export\
**Created:** [February 8, 2023, 3:39pm UTC](https://community.homey.app/t/exporting-all-logic-variables-to-mysql/76182 "2023-02-08T15:39:05Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pat\_M](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/pat_m/32/56295_2.png) [@Pat\_M](https://community.homey.app/u/Pat_M)\
**Post date:** [February 8, 2023, 3:39pm UTC](https://community.homey.app/t/exporting-all-logic-variables-to-mysql/76182/1 "2023-02-08T15:39:05Z")

</div>

Hi!

Is it possible to traverse all my Logic variables and insert them into my MySQL database in an easy way?

Many thanks!

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [February 8, 2023, 5:27pm UTC](https://community.homey.app/t/exporting-all-logic-variables-to-mysql/76182/2 "2023-02-08T17:27:19Z")

</div>

Here’s a way to start:

 ![Screenshot_20230208-182645_Chrome](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/c/6/c6e10871efd959d9d75f4628e2f7463aea967879.jpeg)

> [@\[APP\]\[PRO\] MySQL-Client](https://community.homey.app/t/app-pro-mysql-client/62459):
>
> [[small]](https://homey.app/de-de/app/de.ronnywinkler.mysql/MySQL/) A MySQL client for Homey Add this app to use SQL queries in Homey to read or write datasets from/to a local MySQL compatible database. The app provides a driver/device to connect to a database server and one of its databases. The following flow actions can be used from this device: SELECT a dataset with a SQL query (read periodical logged values to use in Homey). UPDATE/INSERT lines using global tokens (log device capabilities to your database). The following flow triggers can …

---

<div class="post-metadata">

**Author:** ![Arie\_J\_Godschalk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arie_j_godschalk/32/63027_2.png) [@Arie\_J\_Godschalk](https://community.homey.app/u/Arie_J_Godschalk)\
**Post date:** [February 8, 2023, 8:53pm UTC](https://community.homey.app/t/exporting-all-logic-variables-to-mysql/76182/3 "2023-02-08T20:53:38Z")

</div>

Or the app

> **[Exporteer Insights](https://homey.app/nl-nl/app/com.gruijter.insights2csv/Exporteer-Insights/)**
>
> Maak backups van alle insights

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [February 8, 2023, 9:17pm UTC](https://community.homey.app/t/exporting-all-logic-variables-to-mysql/76182/4 "2023-02-08T21:17:25Z")

</div>

That would work for numeric values, Arie, but string and bool variables won’t be exported I think.

---

<div class="post-metadata">

**Author:** ![Arie\_J\_Godschalk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arie_j_godschalk/32/63027_2.png) [@Arie\_J\_Godschalk](https://community.homey.app/u/Arie_J_Godschalk)\
**Post date:** [February 9, 2023, 6:51am UTC](https://community.homey.app/t/exporting-all-logic-variables-to-mysql/76182/5 "2023-02-09T06:51:03Z")

</div>

> [@Peter\_Kawa](#):
>
> but string and bool variables won’t be exported I think

Ah, you might be right Peter!

---

<div class="post-metadata">

**Author:** ![Pat\_M](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/pat_m/32/56295_2.png) [@Pat\_M](https://community.homey.app/u/Pat_M)\
**Post date:** [February 9, 2023, 3:40pm UTC](https://community.homey.app/t/exporting-all-logic-variables-to-mysql/76182/6 "2023-02-09T15:40:14Z")

</div>

Hi,

I have installed the MySQL since earlier and I’m inserting data from my flows into the db. But what I’m really looking for is a (convenient?) way to “flash”-insert/update all of my Logic variables (String/Boolean/Int) ad hoc into the db. So I mirror the Logic variables into MySQL whenever I like to.

I guessing I need a traverse/loop script for all variables and then create a SQL-script with these variables that I will kick off at the the end of the script?

Thanks!

---

<div class="post-metadata">

**Author:** ![Arie\_J\_Godschalk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arie_j_godschalk/32/63027_2.png) [@Arie\_J\_Godschalk](https://community.homey.app/u/Arie_J_Godschalk)\
**Post date:** [February 10, 2023, 5:14pm UTC](https://community.homey.app/t/exporting-all-logic-variables-to-mysql/76182/7 "2023-02-10T17:14:55Z")

</div>

If you use BetterLogic variables, there are multiple ways of exporting them 😉

---

<div class="post-metadata">

**Author:** ![Pat\_M](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/pat_m/32/56295_2.png) [@Pat\_M](https://community.homey.app/u/Pat_M)\
**Post date:** [February 10, 2023, 6:14pm UTC](https://community.homey.app/t/exporting-all-logic-variables-to-mysql/76182/8 "2023-02-10T18:14:10Z")

</div>

Aha, to bad that I already setup all (hundreds) in Logic! 🥲
