Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
M
meta_base_code
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
宋柯
meta_base_code
Commits
00416bf9
Commit
00416bf9
authored
Aug 05, 2021
by
郭羽
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update olap conn
parent
1552b35d
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
46 additions
and
46 deletions
+46
-46
new_user_has_protratit_rate.py
new_user_analysis/new_user_has_protratit_rate.py
+3
-3
new_user_project_protratit.py
new_user_analysis/new_user_project_protratit.py
+1
-1
user_behavior_path.py
new_user_analysis/user_behavior_path.py
+2
-2
meigou_huidu_huisu.py
output/meigou_huidu_huisu.py
+1
-1
out_put_diary_0923.py
output/out_put_diary_0923.py
+1
-1
out_put_user_post_each_strategy.py
output/out_put_user_post_each_strategy.py
+1
-1
output_article_distribution_0917.py
output/output_article_distribution_0917.py
+1
-1
advertisement_strategy_d.py
task/advertisement_strategy_d.py
+2
-2
conent_detail_page_grayscale_ctr.py
task/conent_detail_page_grayscale_ctr.py
+2
-2
core_indicators_monitoring.py
task/core_indicators_monitoring.py
+1
-1
daily_search_word_count.py
task/daily_search_word_count.py
+1
-1
daily_search_word_count_fix.py
task/daily_search_word_count_fix.py
+1
-1
daily_search_word_count_last_two_year.py
task/daily_search_word_count_last_two_year.py
+1
-1
ecommerce_income_report.py
task/ecommerce_income_report.py
+2
-2
high_quality_diary_analysis.py
task/high_quality_diary_analysis.py
+1
-1
home_feed_recommend_strategy_d.py
task/home_feed_recommend_strategy_d.py
+2
-2
meigou_data.py
task/meigou_data.py
+2
-2
portary_article_distribution.py
task/portary_article_distribution.py
+3
-3
recommend_strategy_d.py
task/recommend_strategy_d.py
+2
-2
recommend_strategy_fix.py
task/recommend_strategy_fix.py
+2
-2
search_answer_ctr.py
task/search_answer_ctr.py
+2
-2
search_diary_ctr.py
task/search_diary_ctr.py
+2
-2
search_meigou_ctr.py
task/search_meigou_ctr.py
+2
-2
search_strategy_d.py
task/search_strategy_d.py
+1
-1
search_tractate_ctr.py
task/search_tractate_ctr.py
+2
-2
spark_temp.py
task/spark_temp.py
+1
-1
spark_test.py
task/spark_test.py
+2
-2
tractate_analysis_in_7000.py
task/tractate_analysis_in_7000.py
+1
-1
func_from_es_get_article.py
utils/func_from_es_get_article.py
+1
-1
No files found.
new_user_analysis/new_user_has_protratit_rate.py
View file @
00416bf9
...
...
@@ -29,7 +29,7 @@ from meta_base_code.utils.func_from_redis_get_portrait import *
def
con_sql
(
sql
):
# 从数据库的表里获取数据
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
cursor
.
execute
(
sql
)
...
...
@@ -214,7 +214,7 @@ WHERE spam_pv.device_id IS NULL
)
print
(
instert_sql
)
# cursor.execute("set names 'UTF8'")
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
res
=
cursor
.
execute
(
instert_sql
)
...
...
@@ -268,7 +268,7 @@ WHERE spam_pv.device_id IS NULL
)
print
(
instert_sql
)
# cursor.execute("set names 'UTF8'")
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
res
=
cursor
.
execute
(
instert_sql
)
...
...
new_user_analysis/new_user_project_protratit.py
View file @
00416bf9
...
...
@@ -326,7 +326,7 @@ WHERE spam_pv.device_id IS NULL
)
print
(
instert_sql
)
# cursor.execute("set names 'UTF8'")
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
res
=
cursor
.
execute
(
instert_sql
)
...
...
new_user_analysis/user_behavior_path.py
View file @
00416bf9
...
...
@@ -29,7 +29,7 @@ from pyspark.sql import SparkSession, DataFrame
def
con_sql
(
sql
):
# 从数据库的表里获取数据
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
cursor
.
execute
(
sql
)
...
...
@@ -980,7 +980,7 @@ on t1.device_id = t2.cl_id""".format(partition_date=today_str)
)
print
(
instert_sql
)
# cursor.execute("set names 'UTF8'")
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
res
=
cursor
.
execute
(
instert_sql
)
...
...
output/meigou_huidu_huisu.py
View file @
00416bf9
...
...
@@ -28,7 +28,7 @@ from pyspark.sql import SparkSession, DataFrame
def
con_sql
(
sql
):
# 从数据库的表里获取数据
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
cursor
.
execute
(
sql
)
...
...
output/out_put_diary_0923.py
View file @
00416bf9
...
...
@@ -70,7 +70,7 @@ task_days = 2
def
con_sql
(
sql
):
# 从数据库的表里获取数据
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
cursor
.
execute
(
sql
)
...
...
output/out_put_user_post_each_strategy.py
View file @
00416bf9
...
...
@@ -64,7 +64,7 @@ from meta_base_code.utils.func_from_es_get_article import get_es_article_num, ge
def
con_sql
(
sql
):
# 从数据库的表里获取数据
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
cursor
.
execute
(
sql
)
...
...
output/output_article_distribution_0917.py
View file @
00416bf9
...
...
@@ -67,7 +67,7 @@ task_days = 2
def
con_sql
(
sql
):
# 从数据库的表里获取数据
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
cursor
.
execute
(
sql
)
...
...
task/advertisement_strategy_d.py
View file @
00416bf9
...
...
@@ -23,7 +23,7 @@ from pyspark.sql import SparkSession, DataFrame
from
pyspark.sql.functions
import
lit
import
pytispark.pytispark
as
pti
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
...
...
@@ -31,7 +31,7 @@ cursor = db.cursor()
def
con_sql
(
sql
):
# 从数据库的表里获取数据
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
cursor
.
execute
(
sql
)
...
...
task/conent_detail_page_grayscale_ctr.py
View file @
00416bf9
...
...
@@ -26,7 +26,7 @@ from pyspark.sql import SparkSession, DataFrame
def
con_sql
(
sql
):
# 从数据库的表里获取数据
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
cursor
.
execute
(
sql
)
...
...
@@ -87,7 +87,7 @@ device_df = spark.sql(sql)
device_df
.
show
(
1
,
False
)
sql_res
=
device_df
.
collect
()
print
(
"-----------------------------------------------------------------------------"
)
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
for
res
in
sql_res
:
...
...
task/core_indicators_monitoring.py
View file @
00416bf9
...
...
@@ -541,7 +541,7 @@ FROM
sql_res
=
device_df
.
collect
()
for
res
in
sql_res
:
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
print
(
res
)
...
...
task/daily_search_word_count.py
View file @
00416bf9
...
...
@@ -197,7 +197,7 @@ for t in range(0, task_days):
partition_date
=
str
(
now
+
datetime
.
timedelta
(
days
=-
1
))
tag_names_list_week
.
append
((
word
,
nums
,
uv
,
partition_date
))
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
insert_sql
=
"replace into daily_search_word_count(word, nums, uv,pid,partition_day) VALUES(
%
s,
%
s,
%
s,
%
s,
%
s)"
...
...
task/daily_search_word_count_fix.py
View file @
00416bf9
...
...
@@ -213,7 +213,7 @@ for t in range(0, task_days):
partition_date
=
str
(
now
+
datetime
.
timedelta
(
days
=-
1
))
tag_names_list_week
.
append
((
word
,
nums
,
uv
,
partition_date
))
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
insert_sql
=
"replace into daily_search_word_count_fix(word, nums, uv,pid,partition_day) VALUES(
%
s,
%
s,
%
s,
%
s,
%
s)"
...
...
task/daily_search_word_count_last_two_year.py
View file @
00416bf9
...
...
@@ -304,7 +304,7 @@ for t in range(1, task_days):
# pid = hashlib.md5((today_str + keywords).encode("utf8")).hexdigest()
tag_names_list_week
.
append
((
key_count
,
keywords
,
today_str
,
is_delete
,
servise_num
,
pv
,
is_tag
))
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
# db = pymysql.connect(host='bj-cdb-6slgqwlc.sql.tencentcdb.com', port=62120, user='work', passwd='Gengmei1',
# db='doris_prod')
...
...
task/ecommerce_income_report.py
View file @
00416bf9
...
...
@@ -35,7 +35,7 @@ from pyspark.sql import SparkSession, DataFrame
def
con_sql
(
sql
):
# 从数据库的表里获取数据
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
cursor
.
execute
(
sql
)
...
...
@@ -422,7 +422,7 @@ group by partition_day
cpc_item_pricing
=
cpc_proportion_expend_recharge_amount
/
cpc_click_num
cpc_flow_rat
=
cpc_click_num
/
welfare_pv
# tol_proportion_expend_amount
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
partition_date
=
yesterday_str
...
...
task/high_quality_diary_analysis.py
View file @
00416bf9
...
...
@@ -46,7 +46,7 @@ from meta_base_code.utils.func_from_es_get_article import get_es_article_num, ge
def
con_sql
(
sql
):
# 从数据库的表里获取数据
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
cursor
.
execute
(
sql
)
...
...
task/home_feed_recommend_strategy_d.py
View file @
00416bf9
...
...
@@ -20,7 +20,7 @@ from pyspark.sql import SparkSession, DataFrame
# from pyspark.sql.functions import lit
# import pytispark.pytispark as pti
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
...
...
@@ -28,7 +28,7 @@ cursor = db.cursor()
def
con_sql
(
sql
):
# 从数据库的表里获取数据
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
cursor
.
execute
(
sql
)
...
...
task/meigou_data.py
View file @
00416bf9
...
...
@@ -28,7 +28,7 @@ from pyspark.sql import SparkSession, DataFrame
def
con_sql
(
sql
):
# 从数据库的表里获取数据
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
cursor
.
execute
(
sql
)
...
...
@@ -195,7 +195,7 @@ order by 1
pid
=
hashlib
.
md5
(
(
partition_date
+
device_os_type
+
active_type
+
grey_type
)
.
encode
(
"utf8"
))
.
hexdigest
()
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
commit_sql
=
"""replace into meigou_data(partition_date,device_os_type,active_type,grey_type,clickpv_div_exposurepv,
...
...
task/portary_article_distribution.py
View file @
00416bf9
...
...
@@ -31,7 +31,7 @@ from pyspark.sql import SparkSession, DataFrame
def
con_sql
(
sql
):
# 从数据库的表里获取数据
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
cursor
.
execute
(
sql
)
...
...
@@ -190,7 +190,7 @@ for redis_count,res in enumerate(user_portrait_scan):
)
# print(instert_sql)
# cursor.execute("set names 'UTF8'")
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
res
=
cursor
.
execute
(
instert_sql
)
...
...
@@ -215,7 +215,7 @@ for page_type in range(3):
)
# print(instert_sql)
# cursor.execute("set names 'UTF8'")
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
res
=
cursor
.
execute
(
instert_sql
)
...
...
task/recommend_strategy_d.py
View file @
00416bf9
...
...
@@ -22,7 +22,7 @@ from pyspark.sql import SparkSession, DataFrame
# from pyspark.sql.functions import lit
# import pytispark.pytispark as pti
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
...
...
@@ -30,7 +30,7 @@ cursor = db.cursor()
def
con_sql
(
sql
):
# 从数据库的表里获取数据
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
cursor
.
execute
(
sql
)
...
...
task/recommend_strategy_fix.py
View file @
00416bf9
...
...
@@ -22,14 +22,14 @@ from pyspark.sql import SparkSession, DataFrame
# from pyspark.sql.functions import lit
# import pytispark.pytispark as pti
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
def
con_sql
(
sql
):
# 从数据库的表里获取数据
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
cursor
.
execute
(
sql
)
...
...
task/search_answer_ctr.py
View file @
00416bf9
...
...
@@ -28,7 +28,7 @@ from pyspark.sql import SparkSession, DataFrame
def
con_sql
(
sql
):
# 从数据库的表里获取数据
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
cursor
.
execute
(
sql
)
...
...
@@ -205,7 +205,7 @@ for t in range(0, task_days):
)
print
(
instert_sql
)
# cursor.execute("set names 'UTF8'")
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
res
=
cursor
.
execute
(
instert_sql
)
...
...
task/search_diary_ctr.py
View file @
00416bf9
...
...
@@ -28,7 +28,7 @@ from pyspark.sql import SparkSession, DataFrame
def
con_sql
(
sql
):
# 从数据库的表里获取数据
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
cursor
.
execute
(
sql
)
...
...
@@ -198,7 +198,7 @@ group by t1.partition_date,device_os_type,active_type,channel
print
(
instert_sql_diary
)
print
(
instert_sql_qa
)
# cursor.execute("set names 'UTF8'")
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
res
=
cursor
.
execute
(
instert_sql_diary
)
...
...
task/search_meigou_ctr.py
View file @
00416bf9
...
...
@@ -28,7 +28,7 @@ from pyspark.sql import SparkSession, DataFrame
def
con_sql
(
sql
):
# 从数据库的表里获取数据
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
cursor
.
execute
(
sql
)
...
...
@@ -207,7 +207,7 @@ for t in range(0, task_days):
)
print
(
instert_sql
)
# cursor.execute("set names 'UTF8'")
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
res
=
cursor
.
execute
(
instert_sql
)
...
...
task/search_strategy_d.py
View file @
00416bf9
...
...
@@ -24,7 +24,7 @@ from pyspark.sql import SparkSession, DataFrame
# from pyspark.sql.functions import lit
# import pytispark.pytispark as pti
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
...
...
task/search_tractate_ctr.py
View file @
00416bf9
...
...
@@ -28,7 +28,7 @@ from pyspark.sql import SparkSession, DataFrame
def
con_sql
(
sql
):
# 从数据库的表里获取数据
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
cursor
.
execute
(
sql
)
...
...
@@ -204,7 +204,7 @@ for t in range(0, task_days):
)
print
(
instert_sql
)
# cursor.execute("set names 'UTF8'")
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
res
=
cursor
.
execute
(
instert_sql
)
...
...
task/spark_temp.py
View file @
00416bf9
...
...
@@ -35,7 +35,7 @@ from meta_base_code.utils.func_from_redis_get_portrait import *
def
con_sql
(
sql
):
# 从数据库的表里获取数据
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
cursor
.
execute
(
sql
)
...
...
task/spark_test.py
View file @
00416bf9
...
...
@@ -32,7 +32,7 @@ def con_sql(sql):
# db = pymysql.connect(host='172.16.40.158', port=4000, user='st_user', passwd='aqpuBLYzEV7tML5RPsN1pntUzFy',
# db='jerry_prod')
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
cursor
.
execute
(
sql
)
...
...
@@ -206,7 +206,7 @@ SELECT * FROM online.bl_hdfs_maidian_updates
# )
# print(instert_sql)
# # cursor.execute("set names 'UTF8'")
# db = pymysql.connect(host='172.16.
50.175', port=3306, user='doris', passwd='o5gbA27hXHHm
',
# db = pymysql.connect(host='172.16.
30.136', port=3306, user='doris_olap', passwd='bA27hXasdfswuolap
',
# db='doris_olap')
# cursor = db.cursor()
# res = cursor.execute(instert_sql)
...
...
task/tractate_analysis_in_7000.py
View file @
00416bf9
...
...
@@ -44,7 +44,7 @@ from meta_base_code.utils.func_from_es_get_article import get_es_article_num, ge
def
con_sql
(
sql
):
# 从数据库的表里获取数据
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
cursor
.
execute
(
sql
)
...
...
utils/func_from_es_get_article.py
View file @
00416bf9
...
...
@@ -19,7 +19,7 @@ es = Elasticsearch([
def
con_sql_jerry_prod
(
sql
):
# 从数据库的表里获取数据
db
=
pymysql
.
connect
(
host
=
'172.16.
50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm
'
,
db
=
pymysql
.
connect
(
host
=
'172.16.
30.136'
,
port
=
3306
,
user
=
'doris_olap'
,
passwd
=
'bA27hXasdfswuolap
'
,
db
=
'doris_olap'
)
cursor
=
db
.
cursor
()
cursor
.
execute
(
sql
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment