Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement CREATE PLACEMENT statement #194

Conversation

apstndb
Copy link
Contributor

@apstndb apstndb commented Nov 5, 2024

This PR implements CREATE PLACEMENT DDL statement.

resolve #165

@apstndb apstndb mentioned this pull request Nov 5, 2024
37 tasks
@@ -2421,6 +2424,18 @@ func (p *Parser) parseAlterDatabase(pos token.Pos) *ast.AlterDatabase {
}
}

func (p *Parser) parseCreatePlacement(pos token.Pos) *ast.CreatePlacement {
p.expectKeywordLike("PLACEMENT")
name := p.parseIdent()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the official doc, the name is enclosed in the backticks. Do we need to address this?a

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have not tested in the real multi regional Enterprise Plus instance, but I believe the product accepts name without backquotes.

https://medium.com/google-cloud/distributed-ai-global-and-geo-partitioned-rag-architecture-with-google-cloud-spanner-for-aba9a75fc4c3

$ gcloud spanner databases ddl update news-international-database 
--instance=news-international-instance 
--ddl="CREATE PLACEMENT americas 
       OPTIONS (instance_partition='americas-partition')"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Another question: there is no possibility of accepting Path as a name?

Copy link
Contributor Author

@apstndb apstndb Nov 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a global object and all PLACEMENT KEY in all schemas of the database shares the same namespace.

https://cloud.google.com/spanner/docs/schema-and-data-model#named-schemas

For example, INFORMATION_SCHEMA.PLACEMENTS doesn't have a room to have schema information.

https://cloud.google.com/spanner/docs/information-schema#placements

Column name Type Description
PLACEMENT_NAME STRING The name of the placement.
IS_DEFAULT BOOL A boolean that indicates whether the placement is the default placement.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good. Thank you!

@makenowjust makenowjust merged commit 2bd7987 into cloudspannerecosystem:main Nov 13, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support CREATE PLACEMENT statement
2 participants