将 Microstrategy Cube 连接到 Postgres 物化视图
Connecting Microstrategy Cube to a Postgres Materialized View
我在 Postgres 数据库中创建了一个物化视图。当我创建与此 Postgres 数据库的 microstrategy 多维数据集连接时,我看不到此实体化视图。
谁能帮我理解为什么我看不到这个?
谢谢
找到解决此问题的方法...
您可以将视图创建为标准视图,将其连接到 Microstrategy,然后删除视图并创建为实体化视图。只要您保持相同的名称,这就会选择新创建的实体化视图。
您需要编辑仓库目录的读取设置。
位置:Schema->Warehouse Catalog Options->Catalog->Read Settings
查询 tables:
SELECT n.nspname as NAME_SPACE,
c.relname as TAB_NAME
FROM pg_catalog.pg_class c
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
WHERE c.relkind in ('v', 'm', 'r', 'p', '')
AND n.nspname <> 'pg_catalog'
AND n.nspname <> 'information_schema'
AND n.nspname !~ '^pg_toast'
ORDER BY 1,2
列查询:
在 table INFORMATION_SCHEMA.COLUMNS 上被挂到 LEFT JOIN(到目前为止对我来说没有问题)
SELECT DISTINCT
nspname AS NAME_SPACE,
relname AS TAB_NAME,
attname AS COL_NAME,
typname AS DATA_TYPE,
COALESCE(B.CHARACTER_MAXIMUM_LENGTH, attlen) AS DATA_LEN,
NUMERIC_PRECISION AS DATA_PREC,
NUMERIC_SCALE AS DATA_SCALE
FROM
pg_attribute A
JOIN
pg_class C
ON
A.attrelid = C.oid
JOIN
pg_namespace N
ON
C.relnamespace = N.oid
JOIN
pg_type T
ON
A.atttypid = T.oid
LEFT OUTER JOIN
INFORMATION_SCHEMA.COLUMNS B
ON
A.attname = B.COLUMN_NAME
AND C.relname = B.TABLE_NAME
AND N.nspname = B.TABLE_SCHEMA
WHERE
relname IN (#TABLE_LIST#)
AND attnum > 0
ORDER BY
1,
2,
3
尤其是列查询可以改进,但直到现在我还没有回头看它,因为它工作正常。
所有这些的原因可以在以下讨论中找到:Materialized views don't show up in information_schema。
我在 Postgres 数据库中创建了一个物化视图。当我创建与此 Postgres 数据库的 microstrategy 多维数据集连接时,我看不到此实体化视图。
谁能帮我理解为什么我看不到这个?
谢谢
找到解决此问题的方法...
您可以将视图创建为标准视图,将其连接到 Microstrategy,然后删除视图并创建为实体化视图。只要您保持相同的名称,这就会选择新创建的实体化视图。
您需要编辑仓库目录的读取设置。 位置:Schema->Warehouse Catalog Options->Catalog->Read Settings
查询 tables:
SELECT n.nspname as NAME_SPACE,
c.relname as TAB_NAME
FROM pg_catalog.pg_class c
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
WHERE c.relkind in ('v', 'm', 'r', 'p', '')
AND n.nspname <> 'pg_catalog'
AND n.nspname <> 'information_schema'
AND n.nspname !~ '^pg_toast'
ORDER BY 1,2
列查询: 在 table INFORMATION_SCHEMA.COLUMNS 上被挂到 LEFT JOIN(到目前为止对我来说没有问题)
SELECT DISTINCT
nspname AS NAME_SPACE,
relname AS TAB_NAME,
attname AS COL_NAME,
typname AS DATA_TYPE,
COALESCE(B.CHARACTER_MAXIMUM_LENGTH, attlen) AS DATA_LEN,
NUMERIC_PRECISION AS DATA_PREC,
NUMERIC_SCALE AS DATA_SCALE
FROM
pg_attribute A
JOIN
pg_class C
ON
A.attrelid = C.oid
JOIN
pg_namespace N
ON
C.relnamespace = N.oid
JOIN
pg_type T
ON
A.atttypid = T.oid
LEFT OUTER JOIN
INFORMATION_SCHEMA.COLUMNS B
ON
A.attname = B.COLUMN_NAME
AND C.relname = B.TABLE_NAME
AND N.nspname = B.TABLE_SCHEMA
WHERE
relname IN (#TABLE_LIST#)
AND attnum > 0
ORDER BY
1,
2,
3
尤其是列查询可以改进,但直到现在我还没有回头看它,因为它工作正常。
所有这些的原因可以在以下讨论中找到:Materialized views don't show up in information_schema。