Macro $__timeGroup not working. Please Help

Hi all!
I have a strange(but simple) problem that I seem to not be able to solve.
I have a timeseries database (QuestDB) that i interface with postgresql.
I want to make a query that groups by day the number of jobs executed that day.

The query that i use is the one in Image 1 and the error i get is also shown in the Image 1

I don’t understand why i get the “Unbalanced (” error.
I spent 2 days trying to find a solution but without any success.

If it helps, when i take the generated query and use it in the QuestDB console i get the same error.

If there is anyone who has the same issue or who can help I would be very greatful.

1 Like

Hi maurosuhin :wave:, QuestDB team member here.

It looks like $__timeGroup creates some generated SQL that’s not yet supported. We don’t have the floor or extract functions yet. There is some documentation for using Grafana here which should help: Grafana | QuestDB: the database for time series.

What are you trying to achieve with timeGroup? You’re welcome to join our Slack workspace at http://slack.questdb.io/ if you like.

Hi bsmth :wave:,

First of all thanks for the best timeseries DB and for helping me out.
I joined the slack channel.

To your question:

I’m trying to use Grafana chart called Bar Chart and create a table that i can use with it.
So i want to represent the number of jobs that were executed by month and divide them by what type they are.

So, I have my timestamp, JobType (that can be Analysis or FIPER). Since i cant use the timeGroup macro, how should i structure my query to get the right format for Bar Chart:

I want to replicate the attached image:

If you can help me with this perfect. But if not thanks anyway!

Hello maurosuhin,

I use a “Time series” chart and I group by “day” and by “context” (in your case you can use GROUP BY MONTH(yourdatefield)) to obtain the following result.

Hope this helps

Hello rdardenn,

Thanks for the replay but i’m trying to use Bar Chart which has a specific table structure to work.

Thanks for taking the time to help me :smiley:

appreciate it!!

Hello maurosuhin,

It’s always a pleasure to brainstorm on such a topic.
I have other examples of bar charts, can you show us a result, in table form or csv, of your query to get an idea of your source for the chart?