Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions crates/sqlbuild-host/src/entries/_helpers/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,11 +504,6 @@ pub(crate) const ENTRIES: &[HostEntry] = &[
kind: HostKind::Value,
edge: HostEdge::Executor,
},
HostEntry {
name: "MICROBATCH_TABLE_NAME",
kind: HostKind::Value,
edge: HostEdge::Executor,
},
HostEntry {
name: "MicrobatchStateError",
kind: HostKind::Exception,
Expand Down
1 change: 0 additions & 1 deletion crates/sqlbuild-host/src/entries/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@ pub enum ExecutorHost {
MicrobatchColumnTypes,
MicrobatchDirectIndexes,
MicrobatchGenerationWildcard,
MicrobatchTableName,
MicrobatchStateError,
MicrobatchCoverageProjection,
MicrobatchInterval,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Import bounded fingerprint history without conflating semantic and exact-content hashes.
use serde_json::json;
use sqlbuild_core::constants::FINGERPRINT_TABLE_NAME;
use sqlbuild_recall::records::main::sha256_hex::sha256_hex;
use uuid::Uuid;

Expand Down Expand Up @@ -37,7 +38,7 @@ pub async fn ingest_fingerprints(
(
record.state_database.as_deref(),
&record.state_schema,
"_sqlbuild_fingerprints",
FINGERPRINT_TABLE_NAME,
),
&source_event_id,
)?;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Persist source identities; only legacy rows use a fixed observation-key fallback.
use serde_json::json;
use sqlbuild_core::constants::SOURCE_FRESHNESS_TABLE_NAME;
use sqlbuild_state::freshness::main::event_id::event_id as legacy_event_id;
use sqlbuild_state::freshness::models::FreshnessEventIdentity;
use uuid::Uuid;
Expand Down Expand Up @@ -53,7 +54,7 @@ pub async fn ingest_source_freshness(
(
record.state_database.as_deref(),
&record.state_schema,
"_sqlbuild_source_freshness",
SOURCE_FRESHNESS_TABLE_NAME,
),
&source_event_id,
)?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ use sqlbuild_core::command_output::constants::{
INVOCATION_CONTEXT_ENV,
};
use sqlbuild_core::constants::{
COLUMN_MIGRATION_TABLE_NAME, CONSUMPTION_TABLE_NAME, FINGERPRINT_TABLE_NAME,
MIGRATION_TABLE_NAME, OLD_NAME_VIEW_TABLE_NAME, PROJECT_CONFIG_FILENAME,
AUDIT_RESULTS_TABLE_NAME, COLUMN_MIGRATION_TABLE_NAME, CONSUMPTION_TABLE_NAME,
FINGERPRINT_TABLE_NAME, JANITOR_EVENTS_TABLE_NAME, MICROBATCH_TABLE_NAME, MIGRATION_TABLE_NAME,
NODE_RESULTS_TABLE_NAME, OLD_NAME_VIEW_TABLE_NAME, PROJECT_CONFIG_FILENAME,
PYTHON_INIT_MODULE_STEM, PYTHON_NODE_ROOT, SETTINGS_SECTION, SOURCE_FRESHNESS_TABLE_NAME,
STAGED_PROMOTION_MODE, TABLE_PROMOTION_MODE_SETTING_KEY, ZERO_DAY_DURATION,
};
Expand Down Expand Up @@ -88,6 +89,10 @@ pub(crate) const EXPORTED_TEXTS: &[(&str, &str)] = &[
("MIGRATION_TABLE_NAME", MIGRATION_TABLE_NAME),
("COLUMN_MIGRATION_TABLE_NAME", COLUMN_MIGRATION_TABLE_NAME),
("OLD_NAME_VIEW_TABLE_NAME", OLD_NAME_VIEW_TABLE_NAME),
("MICROBATCH_TABLE_NAME", MICROBATCH_TABLE_NAME),
("NODE_RESULTS_TABLE_NAME", NODE_RESULTS_TABLE_NAME),
("AUDIT_RESULTS_TABLE_NAME", AUDIT_RESULTS_TABLE_NAME),
("JANITOR_EVENTS_TABLE_NAME", JANITOR_EVENTS_TABLE_NAME),
("COLUMN_NODE_TYPE", COLUMN_NODE_TYPE),
("COLUMN_NODE_NAME", COLUMN_NODE_NAME),
("COLUMN_TARGET_DATABASE", COLUMN_TARGET_DATABASE),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
//! Direct-mode microbatch state DDL, idempotent inserts, reads and event IDs.
use pyo3::prelude::{Bound, PyAny, PyAnyMethods, PyModule, PyModuleMethods, PyResult, Python};
use pyo3::types::{PyDict, PyTuple};
use pyo3::types::{PyDict, PyString, PyTuple};
use pyo3::{pyfunction, wrap_pyfunction};
use sqlbuild_core::constants::MICROBATCH_TABLE_NAME;
use sqlbuild_host::entries::models::{AdapterHost, ExecutorHost};
use sqlbuild_state::events::main::microbatch_event_id::microbatch_event_id;
use sqlbuild_state::microbatches::main::create_index_sqls::create_index_sqls;
Expand Down Expand Up @@ -81,7 +82,7 @@ fn qualified_table<'py>(
(database, schema): (&Bound<'py, PyAny>, &Bound<'py, PyAny>),
) -> PyResult<Option<String>> {
let py: Python<'py> = render_qualified_name.py();
let table_name: Bound<'py, PyAny> = host::entry(py, ExecutorHost::MicrobatchTableName)?;
let table_name: Bound<'py, PyAny> = PyString::new(py, MICROBATCH_TABLE_NAME).into_any();
optional_text(&call_with(
render_qualified_name,
&[
Expand Down Expand Up @@ -236,14 +237,13 @@ fn create_indexes<'py>(request: Option<&Bound<'py, PyDict>>) -> PyResult<Bound<'
&[
("database", request.get("database")?),
("schema", schema.clone()),
("name", host::entry(py, ExecutorHost::MicrobatchTableName)?),
("name", PyString::new(py, MICROBATCH_TABLE_NAME).into_any()),
],
)?;
let table: String = if rendered.is_truthy()? {
rendered.extract()?
} else {
let name: String = host::entry(py, ExecutorHost::MicrobatchTableName)?.extract()?;
format!("{}.{name}", schema.str()?)
format!("{}.{MICROBATCH_TABLE_NAME}", schema.str()?)
};
let render_identifier: Bound<'_, PyAny> = request.get("render_identifier")?;
let identifier = |name: &Bound<'_, PyAny>| -> PyResult<String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ use sqlbuild_config::command_connection::constants::{
DUCKDB_ADAPTER, DUCKDB_MEMORY_DATABASE, LOCAL_DATABASE_PATH_KEYS,
};
use sqlbuild_core::constants::{
COLUMN_MIGRATION_TABLE_NAME, CONSUMPTION_TABLE_NAME, FINGERPRINT_TABLE_NAME,
NODE_RESULTS_TABLE_NAME, SOURCE_FRESHNESS_TABLE_NAME,
AUDIT_RESULTS_TABLE_NAME, COLUMN_MIGRATION_TABLE_NAME, CONSUMPTION_TABLE_NAME,
FINGERPRINT_TABLE_NAME, JANITOR_EVENTS_TABLE_NAME, MICROBATCH_TABLE_NAME, MIGRATION_TABLE_NAME,
NODE_RESULTS_TABLE_NAME, OLD_NAME_VIEW_TABLE_NAME, SOURCE_FRESHNESS_TABLE_NAME,
};
use sqlbuild_core::models::SqlValue;
use sqlbuild_orchestration::warehouse_metadata::constants::MAX_HISTORY_RECORDS;
Expand Down Expand Up @@ -167,7 +168,7 @@ fn read_page(
read.after.as_ref().map(|cursor| cursor.as_slice()),
read.observed_since,
read.limit,
"_sqlbuild_audit_results",
AUDIT_RESULTS_TABLE_NAME,
event_columns.as_slice(),
"occurred_at",
),
Expand All @@ -176,7 +177,7 @@ fn read_page(
read.after.as_ref().map(|cursor| cursor.as_slice()),
read.observed_since,
read.limit,
"_sqlbuild_janitor_events",
JANITOR_EVENTS_TABLE_NAME,
event_columns.as_slice(),
"occurred_at",
),
Expand All @@ -185,7 +186,7 @@ fn read_page(
read.after.as_ref().map(|cursor| cursor.as_slice()),
read.observed_since,
read.limit,
"_sqlbuild_migrations",
MIGRATION_TABLE_NAME,
MIGRATION_COLUMNS.as_slice(),
"created_at",
),
Expand All @@ -194,7 +195,7 @@ fn read_page(
read.after.as_ref().map(|cursor| cursor.as_slice()),
read.observed_since,
read.limit,
"_sqlbuild_old_name_views",
OLD_NAME_VIEW_TABLE_NAME,
OLD_NAME_VIEW_COLUMNS.as_slice(),
"created_at",
),
Expand All @@ -203,7 +204,7 @@ fn read_page(
read.after.as_ref().map(|cursor| cursor.as_slice()),
read.observed_since,
read.limit,
"_sqlbuild_microbatches",
MICROBATCH_TABLE_NAME,
event_columns.as_slice(),
"created_at",
),
Expand Down
2 changes: 1 addition & 1 deletion fensu.toml
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ reason = "Native code resolves these through the sqlbuild._native_host name tabl

[[targets.python.dead_code.roots]]
modules = ["sqlbuild.microbatches.constants"]
symbols = ["MICROBATCH_COLUMNS", "MICROBATCH_COLUMN_TYPES", "MICROBATCH_DIRECT_INDEXES", "MICROBATCH_GENERATION_WILDCARD", "MICROBATCH_TABLE_NAME"]
symbols = ["MICROBATCH_COLUMNS", "MICROBATCH_COLUMN_TYPES", "MICROBATCH_DIRECT_INDEXES", "MICROBATCH_GENERATION_WILDCARD"]
reason = "Native code resolves these through the sqlbuild._native_host name table."

[[targets.python.dead_code.roots]]
Expand Down
4 changes: 4 additions & 0 deletions src/sqlbuild/_native.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ CONSUMPTION_TABLE_NAME: str
MIGRATION_TABLE_NAME: str
COLUMN_MIGRATION_TABLE_NAME: str
OLD_NAME_VIEW_TABLE_NAME: str
MICROBATCH_TABLE_NAME: str
NODE_RESULTS_TABLE_NAME: str
AUDIT_RESULTS_TABLE_NAME: str
JANITOR_EVENTS_TABLE_NAME: str
COLUMN_NODE_TYPE: str
COLUMN_NODE_NAME: str
COLUMN_TARGET_DATABASE: str
Expand Down
1 change: 0 additions & 1 deletion src/sqlbuild/_native_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,6 @@
"sqlbuild.microbatches.constants",
"MICROBATCH_GENERATION_WILDCARD",
),
"MICROBATCH_TABLE_NAME": ("sqlbuild.microbatches.constants", "MICROBATCH_TABLE_NAME"),
"MicrobatchStateError": ("sqlbuild.microbatches.exceptions", "MicrobatchStateError"),
"MicrobatchCoverageProjection": (
"sqlbuild.microbatches.models",
Expand Down
1 change: 0 additions & 1 deletion src/sqlbuild/_native_host.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,6 @@ from sqlbuild.microbatches.constants import MICROBATCH_DIRECT_INDEXES as MICROBA
from sqlbuild.microbatches.constants import (
MICROBATCH_GENERATION_WILDCARD as MICROBATCH_GENERATION_WILDCARD,
)
from sqlbuild.microbatches.constants import MICROBATCH_TABLE_NAME as MICROBATCH_TABLE_NAME
from sqlbuild.microbatches.exceptions import MicrobatchStateError as MicrobatchStateError
from sqlbuild.microbatches.models import (
MicrobatchCoverageProjection as MicrobatchCoverageProjection,
Expand Down
4 changes: 2 additions & 2 deletions src/sqlbuild/adapters/postgres/classes/postgres_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1762,7 +1762,7 @@ def render_create_node_result_index_sqls(
database: str | None,
schema: str,
) -> tuple[str, ...]:
from sqlbuild.executor.node_results.constants import NODE_RESULTS_TABLE_NAME
from sqlbuild._native import NODE_RESULTS_TABLE_NAME

table_name: str | None = self.render_qualified_name(
database=database,
Expand Down Expand Up @@ -1798,7 +1798,7 @@ def render_create_audit_result_table_sql(self, *, database: str | None, schema:
def render_create_audit_result_index_sqls(
self, *, database: str | None, schema: str
) -> tuple[str, ...]:
from sqlbuild.executor.audit_results.constants import AUDIT_RESULTS_TABLE_NAME
from sqlbuild._native import AUDIT_RESULTS_TABLE_NAME

return self._state_index_sqls(
table=(database, schema, AUDIT_RESULTS_TABLE_NAME),
Expand Down
4 changes: 2 additions & 2 deletions src/sqlbuild/adapters/sqlite/classes/sqlite_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2549,7 +2549,7 @@ def render_create_node_result_index_sqls(
database: str | None,
schema: str,
) -> tuple[str, ...]:
from sqlbuild.executor.node_results.constants import NODE_RESULTS_TABLE_NAME
from sqlbuild._native import NODE_RESULTS_TABLE_NAME

return self._index_sqls(
database=database,
Expand Down Expand Up @@ -2583,7 +2583,7 @@ def render_create_audit_result_table_sql(self, *, database: str | None, schema:
def render_create_audit_result_index_sqls(
self, *, database: str | None, schema: str
) -> tuple[str, ...]:
from sqlbuild.executor.audit_results.constants import AUDIT_RESULTS_TABLE_NAME
from sqlbuild._native import AUDIT_RESULTS_TABLE_NAME

return self._index_sqls(
database=database,
Expand Down
Loading
Loading