modify_command#

View page source

Modify a Column of an Sqlite Database#

Deprecated#

This command was deprecated on 2021-12-05.

Syntax#

As Program#

dismodat.py database modify \
      table_name column_name row_expression value_expression \
      statement_one statement_two

As Python Function#

dismod_at.modify_command ( database , arg_list )

See Also#

It is simpler to use the set_command when it is it is capable of making a change.

Warning#

You can change any value in the database using the modify command. It is suggested that you re-run the init_command , unless you are certain that the set of model_variables was not affected by this change.

arg_list#

This is a list of strings containing the arguments in the program syntax. To be specific, arg_list [0] is table_name , arg_list [1] is column_name , e.t.c.

database#

Is the file name corresponding to the Sqlite database.

table_name#

Is the name of the table in the database that is modified.

column_name#

Is the name of the column in the table that is modified.

row_expression#

This is a python expression that evaluates to True or False . Only rows where the expression is True are modified.

value_expression#

This is a python expression that specifies the value to be placed in the specified column when the row expression is True .

Expressions#

For each row, an expression can reference the value in a column using the corresponding column name. In other words, for each column, a variable with the column name is set to the value in that column.

statements#

There may be zero or more python statements at the end of the command line. Each one is executed before the expressions are evaluated. For example, one of the statements might be

from math import exp

This would make the function exp ( x ) available for use in row_expression and value_expression .

Log Table#

See dismodat.py .

Example#

The file modify_command.py contains an example and test using this command.