No tables in Grafana builder for PostgreSQL - postgresql

I have setup Grafana and PostgreSQL.
I have connect Grafana to Postgresql, and I can run a query if I select "code" in the Explore and pick the Postgresql data source.
But if I use the builder, and would select the table from the table dropdown it mention "no options found"
Why can't I pick the table and columns in the builder?

I did set my search path in postgresql and now I can see the table:
ALTER ROLE grafanareader set search_path = "my schema";

Related

postgresql text search in json column with knex.js

I'm using the postgresql in node application with knex.js
I want to search for a value that is present in the JSON column
I'm able to do the same in posgresql but unable to find any equivalant in knex.js
select * from <table_name> where <json_column_name>::text like '%search_value%'

Birt/Set Schema and Set Path

I'm currently using a schema that will be changed to another schema in a couple of months. I do not not want to have to remove the SCHEMA_NAME multiple times from each report. All the reports so far have this format:
SELECT
COLUMN_NAME1,
SCHEMA_NAME.USER_DEFINED_FUNCTION(COLUMN_NAME2),
COLUMN_NAME3
FROM
SCHEMA_NAME.TABLE_NAME
I want to remove the schema name from the query so it looks like this:
SET SCHEMA LROUIM;
SET PATH LROUIM;
SELECT
COLUMN_NAME1,
USER_DEFINED_FUNCTION(COLUMN_NAME2),
COLUMN_NAME3
FROM
TABLE_NAME
I need the "SET SCHEMA" for the table name and "SET PATH" for the User Defined Function. This code works in Squirrel SQL, but if I insert this code into a Birt data set of type SQL SELECT QUERY, I get an error because of
SET SCHEMA LROUIM;
SET PATH LROUIM;
How do I implement SET SCHEMA and SET PATH in a SQL Select Query in Birt?
I think BIRT uses a JDBC connexion, and you can modify the connection parameters by specifying a default schema.

How to make Microstrategy to work with user schema in Redshift / psql tables?

I use Amazon Redshift with MIcrostrategy.
In Microstrategy i can see properly all tables from public schema.
When I created my own schema, however, Microstrategy "sees" the tables, but does not see the fields inside them (i.e. when I click on a table, Microstrategy does not show the fields inside).
Any ideas what may I be doing wrong / how to configure Microstrategy to work with a schema other then "public"?
Thank you!
You probably need to add your schemas to the SEARCH_PATH for the user that Microstrategy is using to access the database.
If someone besides that user has created the tables then you may also need to GRANT access to the Microstrategy user.
Note: I do not use Microstrategy, this advice is based on issues I've seen with Tableau.
In Amazon Redshift, you have to set the table schema prefixes in the database instance and it worked for me. Below are the steps to make MicrosStrategy 9.4.1 connect to Redshift.
Specify Redshift schema name under Database instance > Advamced > Table Space name
Give Table Space Name / Schema name at Warehouse Catalog > Options >
Catalog > Custom Database login > select > select your login
Warehouse Catalog > Options > View > Table Prefixes > Check
Automatically.. + Select Set default prefix + Select default prefix
from drop down
Warehouse Catalog > Options > View > Table Name
Spaces > Check Display the name space for each table
After these steps, the data model should show columns for selected tables.

PostgreSQL: How to delete dynamically created table using SQL

I am developing a windows application and using Postgres as backend database. At some point in my application i am dynamically creating table e.g Table1, then Table2 and so on. In this way i have many dynamic table in my database. Now i provide a button "Clean Database", so i need to remove all those dynamic tables using SQL query. Should some one guide me how to write SQL Query that automatically delete all such tables?
You should just be able to say
DROP TABLE {tablename}
for each dynamically created table. Try that and see if it works.

How can I determine if an Oracle table has the ROWDEPENDENCIES option set?

I only have the basic Oracle tools available, i.e. SQL Plus, and I need to find out if a table was created with the ROWDEPENDENCIES option. It's a 10g database.
And, if it isn't set, can I use ALTER TABLE to set it, or do I have to drop and re-create the table?
SELECT owner, table_name, dependencies FROM dba_tables;
This will return "ENABLED" or "DISABLED" for each table. If you don't have access to dba_tables, query all_tables instead.
You cannot change this after the table has been created, so you'll have to re-create the table to set it on.