utils

mcp_ohmy_sql.sa.utils.get_create_view_sql(engine: Engine, select: Select, view_name: str, db_type: DbTypeEnum) str[source]

Generate SQL statement to create a view from a given select statement.

Parameters:
  • engine – SQLAlchemy engine to compile the select statement.

  • select – SQLAlchemy Select object representing the query for the view.

  • view_name – Name of the view to be created.

Returns:

SQL statement to create the view.

mcp_ohmy_sql.sa.utils.get_drop_view_sql(view_name: str, db_type: DbTypeEnum) str[source]

Generate SQL statement to drop a view.

Parameters:
  • view_name – Name of the view to be dropped.

  • db_type – Type of the database (e.g., SQLite, PostgreSQL).

Returns:

SQL statement to drop the view.