def evaluate_config_reset(ir: irast.ConfigReset, schema: s_schema.Schema): return config.Operation( opcode=config.OpCode.CONFIG_RESET, level=config.OpLevel.SYSTEM if ir.system else config.OpLevel.SESSION, setting_name=ir.name, value=None, )
def evaluate_config_set(ir: irast.ConfigSet, schema: s_schema.Schema): return config.Operation( opcode=config.OpCode.CONFIG_SET, level=config.OpLevel.SYSTEM if ir.system else config.OpLevel.SESSION, setting_name=ir.name, value=evaluate_to_python_val(ir.expr, schema), )
def evaluate_config_reset(ir: irast.ConfigReset, schema: s_schema.Schema) -> Any: if ir.selector is not None: raise UnsupportedExpressionError( 'filtered CONFIGURE RESET is not supported by static eval') return config.Operation( opcode=config.OpCode.CONFIG_RESET, level=config.OpLevel.SYSTEM if ir.system else config.OpLevel.SESSION, setting_name=ir.name, value=None, )
def evaluate_config_set(ir: irast.ConfigSet, schema: s_schema.Schema) -> Any: value = evaluate_to_python_val(ir.expr, schema) if ir.cardinality is qltypes.SchemaCardinality.Many: if value is None: value = [] elif not typeutils.is_container(value): value = [value] return config.Operation( opcode=config.OpCode.CONFIG_SET, scope=ir.scope, setting_name=ir.name, value=value, )
def evaluate_config_set( ir: irast.ConfigSet, schema: s_schema.Schema) -> Any: if ir.scope == qltypes.ConfigScope.GLOBAL: raise UnsupportedExpressionError( 'SET GLOBAL is not supported by static eval' ) value = evaluate_to_python_val(ir.expr, schema) if ir.cardinality is qltypes.SchemaCardinality.Many: if value is None: value = [] elif not typeutils.is_container(value): value = [value] return config.Operation( opcode=config.OpCode.CONFIG_SET, scope=ir.scope, setting_name=ir.name, value=value, )