Hi All,
I am trying to create a graph on tables that is not in default schema. But I am not able to do so. Is this operation not supported or there is any other setting that I need to change?
Simplified DDL-
create schema TestSchema;
CREATE TABLE TestSchema.UsersTest (
UserID INT64 NOT NULL,
Name STRING(MAX))
PRIMARY KEY (UserID);
CREATE TABLE TestSchema.ProductsTest (
ProductID INT64 NOT NULL,
ProductName STRING(MAX),)
PRIMARY KEY (ProductID);
CREATE TABLE TestSchema.UserReviewsProductTest (
ReviewID INT64 NOT NULL,
UserID INT64 NOT NULL,
ProductID INT64 NOT NULL,
Rating INT64)
PRIMARY KEY (ReviewID);
CREATE PROPERTY GRAPH `TestSchema`.`MyGraphTest`
NODE TABLES (
TestSchema.UsersTest,
TestSchema.ProductsTest
);
gives me following error-
Moreover, If I try to create graph in default schema, it does not recognise tables created in other label.
CREATE PROPERTY GRAPH `MyGraphTest`
NODE TABLES (
TestSchema.UsersTest,
TestSchema.ProductsTest
);
Can anyone please help me with this.
The issue you're encountering stems from a current limitation in the Spanner Graph feature. While Spanner supports named schemas, the CREATE PROPERTY GRAPH statement in Spanner Graph does not support schema-qualified table names. This means that when defining a property graph, you must reference tables without their schema qualifiers.
Workaround:
To utilize the Spanner Graph feature effectively:
Define your tables in the default schema (i.e., without specifying a schema name):
CREATE TABLE UsersTest (
UserID INT64 NOT NULL,
Name STRING(MAX)
) PRIMARY KEY (UserID);
Create the property graph without schema qualifiers:
CREATE PROPERTY GRAPH MyGraphTest
NODE TABLES (
UsersTest
);