Spaces:
Sleeping
Sleeping
File size: 1,788 Bytes
64d23b1 d1f387b a17ace2 d1f387b b77670f 9084383 44968b0 fc16802 64c124e d1f387b 64d23b1 d1f387b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# Функция для замены NULL на пустые строки
def replace_null_with_empty_string(conn):
cursor = conn.cursor()
query = """
UPDATE contacts
SET
name = COALESCE(name, ''),
phone = COALESCE(phone, ''),
email = COALESCE(email, ''),
vk_id = COALESCE(vk_id, ''),
chat_id = COALESCE(chat_id, ''),
ws_st = COALESCE(ws_st, ''),
ws_stop = COALESCE(ws_stop, ''),
web_st = COALESCE(web_st, ''),
fin_prog = COALESCE(fin_prog, ''),
b_city = COALESCE(b_city, ''),
b_fin = COALESCE(b_fin, ''),
b_ban = COALESCE(b_ban, ''),
b_ign = COALESCE(b_ign, ''),
b_baners = COALESCE(b_baners, ''),
b_butt = COALESCE(b_butt, ''),
b_mess = COALESCE(b_mess, ''),
orders = COALESCE(orders, '{}'),
curator = COALESCE(curator, ''),
bonus = COALESCE(bonus, ''),
shop_status = COALESCE(shop_status, ''),
answers = COALESCE(answers, ''),
quiz = COALESCE(quiz, ''),
kassa = COALESCE(kassa, ''),
gc_url = COALESCE(gc_url, ''),
key_pr = COALESCE(key_pr, ''),
n_con = COALESCE(n_con, ''),
canal = COALESCE(canal, ''),
data_on = COALESCE(data_on, ''),
data_t = COALESCE(data_t, ''),
utm_source = COALESCE(utm_source, ''),
utm_medium = COALESCE(utm_medium, ''),
utm_campaign = COALESCE(utm_campaign, ''),
utm_term = COALESCE(utm_term, ''),
utm_content = COALESCE(utm_content, ''),
gcpc = COALESCE(gcpc, '')
"""
cursor.execute(query)
conn.commit() |