Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

replace sqlalchemy

updated_rows = (
    session.query(YourTable)
    .filter(YourTable.your_field.like('%est%'))
    .update({YourTable.your_field: func.replace(YourTable.your_field, 'from_str', 'to_str')},
            synchronize_session=False)
    )
print("Updated {} rows".format(updated_rows))
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #replace #sqlalchemy
ADD COMMENT
Topic
Name
7+9 =