How to list the content of a column from a table mariadb

Hi!
I am trying to integrate data from a table into an entity. I have mariadb installed, and I have created a database called ‘domo’. From this base I want to extract all the entries belonging to a given column, and create with them a drop-down selector in Hass.

At the moment I have managed to create an SQL entity with a “SELECT column FROM table” request, but I only get a sensor that shows the first entry of the column.

Any idea??
Thanks in advance

Are you using this?

It would be by design, since it’s for creating sensors:

An SQL QUERY string, should return 1 result at most.

If you don’t have too many options, you could craft a query that returns a single comma-separated string, depending on the DB engine used. The state value must be less than 255 characters (an HA state limit).

You can then call the set_options service for an input select helper and use a template to make the CSV a list.

I have A LOT of entries…thats the reason i want a deployable. I want to select one entry from the list, and configure some automations based on this selection

OK, then I think it’s time to understand more about how you will be using this (the use case).

Is your list very dynamic, i.e. the entries will change often, of is it fairly static? Also, are we talking tens, hundreds or even thousands? How will you be selecting from the options? Cycle through them in order, or make a random selection?

I suspect you might run into all kinds of issues (slowdowns, limits) with input selects with many, many options or automations with many, many triggers.

You can store a list e.g. in a template sensor’s attribute.

The plan is:

  • a table with a set of columns - Id/name/type/

  • here i Will insert the entries, and eventually Will add more

  • in home assistant, create a “form” where i Will select from the table the “name” desired, filtered by “type”

Apply the automations according to “name” selected.

The list of entries Will stay under 200