Documentation
¶
Index ¶
- func RenameSelfReference(renamer TableRenamer, dialect, assetName, schemaPrefix, sql string) (string, error)
- func UnprefixedName(assetName, schemaPrefix string) (string, bool)
- type DevEnvQueryModifier
- func (d *DevEnvQueryModifier) Modify(ctx context.Context, p *pipeline.Pipeline, a *pipeline.Asset, q *query.Query) (*query.Query, error)
- func (d *DevEnvQueryModifier) ModifyForConnection(ctx context.Context, schemaPrefix, connName string, conn any, q *query.Query) (*query.Query, error)
- func (d *DevEnvQueryModifier) RegisterAssetForSchemaCache(ctx context.Context, p *pipeline.Pipeline, a *pipeline.Asset, q *query.Query) error
- type TableRenamer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RenameSelfReference ¶ added in v0.11.813
func RenameSelfReference(renamer TableRenamer, dialect, assetName, schemaPrefix, sql string) (string, error)
RenameSelfReference points references to an asset's own table at its prefixed name, without connecting to the database. assetName is the already prefixed name, e.g. "dev_mart.events". Only references written exactly as the unprefixed name are renamed, the same rule Modify uses: whether MART.events and mart.events are the same table depends on the dialect and on quoting, which UsedTables does not report. Other tables are left as written, since whether their prefixed copies exist can only be checked on the database.
func UnprefixedName ¶ added in v0.11.813
UnprefixedName returns the name an asset had before its schema was prefixed, e.g. "mart.table1" for "dev_mart.table1". It reports false when the name is not a schema.table or catalog.schema.table name with a prefixed schema.
Types ¶
type DevEnvQueryModifier ¶
type DevEnvQueryModifier struct {
Dialect string
Conn config.ConnectionGetter
Parser TableRenamer
// contains filtered or unexported fields
}
func (*DevEnvQueryModifier) ModifyForConnection ¶ added in v0.11.813
func (d *DevEnvQueryModifier) ModifyForConnection(ctx context.Context, schemaPrefix, connName string, conn any, q *query.Query) (*query.Query, error)
ModifyForConnection rewrites a query that does not belong to an asset, such as an ad-hoc `bruin query`, the same way Modify does: each schema.table reference is pointed at the prefixed schema when that table exists there.