dataflow.db.schema¶

Database schema management for the Haive Registry System.

This module provides functions for creating and managing the database schema for the registry system. It handles schema creation, migrations, and upgrades as needed.

Functions¶

check_schema_exists([client])

Check if the registry schema exists.

check_table_exists(table_name[, schema, client])

Check if a specific table exists.

create_schema_sql()

Generate the SQL schema definition for the registry system.

execute_schema_sql([client, schema_sql])

Execute the schema SQL to set up the database.

initialize_database([client])

Initialize the database for the registry system.

setup_execute_sql_function([client])

Set up the execute_sql function in the database. This function is needed.

setup_schema([client])

Set up the database schema for the registry system.

Module Contents¶

dataflow.db.schema.check_schema_exists(client=None)¶

Check if the registry schema exists.

Parameters:

client – Optional Supabase client

Returns:

True if the schema exists, False otherwise

Return type:

bool

dataflow.db.schema.check_table_exists(table_name, schema='registry', client=None)¶

Check if a specific table exists.

Parameters:
  • table_name (str) – Name of the table to check

  • schema (str) – Schema name

  • client – Optional Supabase client

Returns:

True if the table exists, False otherwise

Return type:

bool

dataflow.db.schema.create_schema_sql()¶

Generate the SQL schema definition for the registry system.

Returns:

SQL schema definition as a string

Return type:

str

dataflow.db.schema.execute_schema_sql(client=None, schema_sql=None)¶

Execute the schema SQL to set up the database.

Parameters:
  • client – Optional Supabase client

  • schema_sql (str | None) – Optional schema SQL to execute

Returns:

True if successful, False otherwise

Return type:

bool

dataflow.db.schema.initialize_database(client=None)¶

Initialize the database for the registry system.

Parameters:

client – Optional Supabase client

Returns:

True if successful, False otherwise

Return type:

bool

dataflow.db.schema.setup_execute_sql_function(client=None)¶

Set up the execute_sql function in the database. This function is needed. to execute arbitrary SQL statements.

Parameters:

client – Optional Supabase client

Returns:

True if successful, False otherwise

Return type:

bool

dataflow.db.schema.setup_schema(client=None)¶

Set up the database schema for the registry system.

Parameters:

client – Optional Supabase client

Returns:

True if successful, False otherwise

Return type:

bool