DmitrMakeev
commited on
Commit
•
4bd1c93
1
Parent(s):
66a3422
Create base.py
Browse files
base.py
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Функция для замены NULL на пустые строки
|
2 |
+
def replace_null_with_empty_string(conn):
|
3 |
+
cursor = conn.cursor()
|
4 |
+
query = """
|
5 |
+
UPDATE contacts
|
6 |
+
SET
|
7 |
+
name = COALESCE(name, ''),
|
8 |
+
phone = COALESCE(phone, ''),
|
9 |
+
email = COALESCE(email, ''),
|
10 |
+
vk_id = COALESCE(vk_id, ''),
|
11 |
+
chat_id = COALESCE(chat_id, ''),
|
12 |
+
ws_st = COALESCE(ws_st, ''),
|
13 |
+
ws_stop = COALESCE(ws_stop, ''),
|
14 |
+
web_st = COALESCE(web_st, ''),
|
15 |
+
fin_prog = COALESCE(fin_prog, ''),
|
16 |
+
b_city = COALESCE(b_city, ''),
|
17 |
+
b_fin = COALESCE(b_fin, ''),
|
18 |
+
b_ban = COALESCE(b_ban, ''),
|
19 |
+
b_ign = COALESCE(b_ign, ''),
|
20 |
+
b_baners = COALESCE(b_baners, ''),
|
21 |
+
b_butt = COALESCE(b_butt, ''),
|
22 |
+
b_mess = COALESCE(b_mess, ''),
|
23 |
+
shop_st = COALESCE(shop_st, ''),
|
24 |
+
curator = COALESCE(curator, ''),
|
25 |
+
pr1 = COALESCE(pr1, ''),
|
26 |
+
pr2 = COALESCE(pr2, ''),
|
27 |
+
pr3 = COALESCE(pr3, ''),
|
28 |
+
pr4 = COALESCE(pr4, ''),
|
29 |
+
pr5 = COALESCE(pr5, ''),
|
30 |
+
gc_url = COALESCE(gc_url, ''),
|
31 |
+
key_pr = COALESCE(key_pr, ''),
|
32 |
+
n_con = COALESCE(n_con, ''),
|
33 |
+
canal = COALESCE(canal, ''),
|
34 |
+
data_on = COALESCE(data_on, ''),
|
35 |
+
data_t = COALESCE(data_t, ''),
|
36 |
+
utm_source = COALESCE(utm_source, ''),
|
37 |
+
utm_medium = COALESCE(utm_medium, ''),
|
38 |
+
utm_campaign = COALESCE(utm_campaign, ''),
|
39 |
+
utm_term = COALESCE(utm_term, ''),
|
40 |
+
utm_content = COALESCE(utm_content, ''),
|
41 |
+
gcpc = COALESCE(gcpc, '')
|
42 |
+
"""
|
43 |
+
cursor.execute(query)
|
44 |
+
conn.commit()
|