File size: 1,755 Bytes
4bd1c93
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
45
# Функция для замены 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, ''),
            shop_st = COALESCE(shop_st, ''),
            curator = COALESCE(curator, ''),
            pr1 = COALESCE(pr1, ''),
            pr2 = COALESCE(pr2, ''),
            pr3 = COALESCE(pr3, ''),
            pr4 = COALESCE(pr4, ''),
            pr5 = COALESCE(pr5, ''),
            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()