WordPress sql find and replace

wordpress sql find and replace UPDATE wp_options SET option_value = replace(option_value, ‘http://www.oldurl’, ‘http://www.newurl’) WHERE option_name = ‘home’ OR option_name = ‘siteurl’; UPDATE wp_posts SET guid = replace(guid, ‘http://www.oldurl’,’http://www.newurl’); UPDATE wp_posts SET post_content = replace(post_content, ‘http://www.oldurl’, ‘http://www.newurl’); UPDATE wp_postmeta SET meta_value = replace(meta_value,’http://www.oldurl’,’http://www.newurl’);

WordPress sql find and replace Read More

Update a row in sql

sql update query –update query example UPDATE table_name SET column1 = value1, column2 = value2, … WHERE condition; update a row in sql UPDATE table_name SET column1 = value1, column2 = value2, … WHERE condition; sql update record SQL> UPDATE CUSTOMERS SET ADDRESS = ‘Pune’ WHERE ID = 6; sql update from select UPDATE YourTable […]

Update a row in sql Read More

Sqlalchemy sequence postgresql

sqlalchemy sequence postgresql #!/usr/bin/env python from sqlalchemy import create_engine, Column, Integer, String, Sequence from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() USER_ID_SEQ = Sequence(‘user_id_seq’) # define sequence explicitly class User(Base): __tablename__ = ‘users’ # use sequence in column definition, and pass .next_value() as server_default id = Column(Integer, USER_ID_SEQ, primary_key=True, server_default=USER_ID_SEQ.next_value()) name = Column(String(50)) fullname = Column(String(50)) […]

Sqlalchemy sequence postgresql Read More