PostgresSQL (Redshift) public schema is not showing

Posts   
 
    
amccool avatar
amccool
User
Posts: 18
Joined: 08-Jun-2007
# Posted on: 01-Mar-2013 17:23:49   

I'm working with a PostgreSql database, actually the AWS Redshift database. I can see tables from manually created schema's, but tables in the public schema are not visible in the designer.

Is this is permissions issue?

LLBLgen 3.5 .net 4.0 March 22nd, 2012 npgsql 2.0.12.1 windows 7 64

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 02-Mar-2013 06:52:53   
  • Does it work on you local dev server with the same DB schema?
  • Are you connecting with a master credentials (like postgres)?
  • When you say that they are not visible, Are you talking about the Reverse-Engineer wizard?
  • What PostgresSQL server version does AWS have on Redshift?

I never used Redshift, but SQL Azure, and I do work always on my local DB, so I never connect LLBLGen Designer directly to the cloud server. At the generated code you can change the connection string at the config file. Is there any reason why you want to connect LLBLGen Designer directly to Redshift?

David Elizondo | LLBLGen Support Team
amccool avatar
amccool
User
Posts: 18
Joined: 08-Jun-2007
# Posted on: 04-Mar-2013 19:26:17   

daelmo wrote:

  • Does it work on you local dev server with the same DB schema?
  • Are you connecting with a master credentials (like postgres)?
  • When you say that they are not visible, Are you talking about the Reverse-Engineer wizard?
  • What PostgresSQL server version does AWS have on Redshift?

1) I don't have a local installation of PostgreSQL that matches the version at AWS 2) I connect with whats considered the "master" user account for the database 3) Reverse-Engineer, yes, Database first design 4) PostgreSQL 8.0.2 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3), Redshift 1.0.516

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 05-Mar-2013 06:46:04   

Redshift looks interesting, I can't find a free tier to test with though. From the Unsupported features I find difficult to you to get it working without problem. I deserve the tries anyway.

If you are connection as master then you should be able to query the public schema, however I'm not sure whether Redshift stores it's metadata in the same way that PG does (ref: http://docs.aws.amazon.com/redshift/latest/dg/c_intro_catalog_views.html). You should investigate whether you are able to query traditional system PG tables on the public schema.

David Elizondo | LLBLGen Support Team
amccool avatar
amccool
User
Posts: 18
Joined: 08-Jun-2007
# Posted on: 05-Mar-2013 07:27:39   

daelmo wrote:

From the Unsupported features I find difficult to you to get it working without problem.

What specifically are you referring to as a problem to using the designer?

daelmo wrote:

If you are connection as master then you should be able to query the public schema, however I'm not sure whether Redshift stores it's metadata in the same way that PG does (ref: http://docs.aws.amazon.com/redshift/latest/dg/c_intro_catalog_views.html). You should investigate whether you are able to query traditional system PG tables on the public schema.

Could you give me a test sql statement to execute to make sure that the designer can query the system tables?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39861
Joined: 17-Aug-2003
# Posted on: 06-Mar-2013 10:03:52   

The driver's sourcecode is available to you in the customer area (v3.5 -> extra's section).

It uses 3 stages: - PostgreSqlDBDriver will return the names of elements, e.g. tables, views etc. - PostgreSqlCatalogRetriever governs the retrieval of all meta-data of a catalog/db - PostgreSqlSchemaRetriever will for every element you select in the 1st screen of the db refresher retrieve the meta-data, so fields for tables etc.

I think it's easiest to start with PostgreSqlDBDriver, because if those queries already return 0 rows, you won't be able to select any elements so no tables will be fetched.

To get all schemas: SELECT * FROM information_schema.schemata

To get all tables for a schema:

SELECT t.table_name, obj_description(c.oid, 'pg_class') as table_comment FROM information_schema.tables t INNER JOIN pg_class c ON t.table_name = c.relname INNER JOIN pg_namespace s ON t.table_schema = s.nspname AND s.oid = c.relnamespace WHERE t.table_schema = 'SCHEMA_NAME' AND t.table_type = 'BASE TABLE'

where you replace SCHEMA_NAME with the name of a schema in your catalog/DB.

Obtain fields for table:


SELECT c.*, col_description(t.oid, c.ordinal_position) as column_comment FROM INFORMATION_SCHEMA.COLUMNS c INNER JOIN pg_class t ON c.table_name = t.relname INNER JOIN pg_namespace s ON c.table_schema = s.nspname AND s.oid = t.relnamespace WHERE table_schema='SCHEMA_NAME' AND table_name = 'TABLE_NAME' ORDER BY ordinal_position asc

Here you again replace SCHEMA_NAME with the name of the schema, and TABLE_NAME with the name of the table.

But I agree with David, it's likely they store the meta-data differently.

Frans Bouma | Lead developer LLBLGen Pro