Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Apache Shardingsphere SchemaMetaDataPersistService Persist

From Leeroopedia


Knowledge Sources
Domains Persistence, Metadata
Last Updated 2026-02-10 00:00 GMT

Overview

Persistence service for schema metadata operations including add, drop, and load with associated tables and views.

Description

SchemaMetaDataPersistService manages the persistence of schema metadata in the registry center. It handles schema creation, deletion, and loading of complete schema structures including all associated tables and views via TableMetaDataPersistService and ViewMetaDataPersistService.

Usage

Used by DatabaseMetaDataPersistFacade to manage schema persistence during DDL operations and metadata initialization.

Code Reference

Source Location

Signature

@RequiredArgsConstructor
public final class SchemaMetaDataPersistService {

    private final PersistRepository repository;

    public void add(String databaseName, String schemaName);
    public void drop(String databaseName, String schemaName);
    public ShardingSphereSchema load(String databaseName, String schemaName);
}

Import

import org.apache.shardingsphere.mode.metadata.persist.metadata.service.SchemaMetaDataPersistService;

I/O Contract

Inputs

Name Type Required Description
databaseName String Yes Target database
schemaName String Yes Target schema

Outputs

Name Type Description
load() returns ShardingSphereSchema Complete schema with tables and views

Usage Examples

SchemaMetaDataPersistService service = persistFacade.getSchemaMetaDataService();

// Add a new schema
service.add("my_database", "public");

// Load schema with all tables and views
ShardingSphereSchema schema = service.load("my_database", "public");

// Drop a schema
service.drop("my_database", "old_schema");

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment