Hi,

I am getting below error while running Redash. Should i be creating table “queries”? Could you help to resolve this issue?

Task redash.tasks.refresh_queries raised unexpected: ProgrammingError(‘ERROR’, ‘42P01’, ‘relation “queries” does not exist’, ‘436’, ‘parse_relation.c’, ‘1159’, ‘parserOpenTable’, ‘’, ‘’)

-ERROR/Worker-49] SELECT “t1”.“id”, “t1”.“updated_at”, “t1”.“created_at”, “t1”.“data_source_id”, “t1”.“latest_query_data_id”, “t1”.“name”, “t1”.“description”, “t1”.“que
ry”, “t1”.“query_hash”, “t1”.“api_key”, “t1”.“user_email”, “t1”.“user_id”, “t1”.“last_modified_by_id”, “t1”.“is_archived”, “t1”.“schedule”, “t2”.“retrieved_at”, “t3”.“id”, “t3”.“name”, “t3”.“ty
pe”, “t3”.“options”, “t3”.“queue_name”, “t3”.“scheduled_queue_name”, “t3”.“created_at” FROM “queries” AS t1 INNER JOIN “query_results” AS t2 ON (“t1”.“latest_query_data_id” = “t2”.“id”) INNER J
OIN “data_sources” AS t3 ON (“t1”.“data_source_id” = “t3”.“id”) WHERE (“t1”.“schedule” IS NOT %s) [None]
Traceback (most recent call last):

Thanks

It’s hard to help without proper context and details about your setup. But in general, yes - you need to create this table and the other ones Redash uses.

You can do this with the CLI (manage.py) with the database create_tables command.

2 Likes

Sometimes I find this when starting my dev environment.

With me, this usually happens when the database is not properly initialized.

So what I execute is: docker-compose up postgres

… and in another tab I execute the ./setup/docker/create_database.sh

then I execute docker-compose up -d and start working again :slight_smile:

Many thanks! Especially for CLI.

Hi, I’m running in to the same problem. Could you give some more context where I can find this manage.py?

Edit: Seems I found it!

  1. Use this to get in to the Redash server container

docker exec -t -i mycontainer /bin/bash

(From here: linux - Exploring Docker container's file system - Stack Overflow)

  1. This step not necessary

ls

Should see “manage.py”

  1. python manage.py database create_tables

If you’re running inside Docker you don’t need to manually access manage.py. Check out the redash docs.

# Create tables
docker-compose run --rm server create_db