大杂烩

Python模拟新浪微博登录

http://blog.javachen.com/2014/03/18/simulate-weibo-login-in-python.html

 

Spark简介

http://blog.javachen.com/2015/02/03/spark-programming-guide.html

#########

当spyder程序出现闪退,只需将spyder2文件夹删除,然后重新启动spyder程序即可正常运行!

http://www.ithao123.cn/content-3081462.html

 

##recent_30days_info

#!/bin/sh
yesterday=\'`date -d "-1 day" +%Y-%m-%d`\'
today=\'`date +%Y-%m-%d`\'
before_30days=\'`date -d "-30 day" +%Y-%m-%d`\'
file_name="user_info_"`date -d"-1 day" +%Y%m%d`".txt"

sql="select t1.date_time,
       t1.pingan_user,
       t2.agent_user,
       t3.total_zr_user,
       t4.pingan_active_user,
       t5.agent_active_user,
       t6.zr_active_user,
       t7.pingan_valid_user,
       t8.agent_valid_user,
       t9.zr_valid_user,
       t10.pingan_valid_active_user,
       t11.agent_valid_active_user,
       t12.zr_valid_active_user
  from (select ${yesterday} as date_time,
               count(distinct mp.user_id) pingan_user
          from mln_enterprise me
          join mln_emp mp
            on me.enterprise_id = mp.enterprise_id
          left outer join (select distinct me.user_id
                            from mln_emp me
                            join mln_identity mi
                              on me.id_mln_emp = mi.id_mln_emp
                            join (select meo.org_id,
                                        meo.full_path,
                                        split(meo.full_path,'/')[0] as p_id,
                                        split(meo.full_path, '/')[1] as c_id
                                   from mln_enterprise_org meo) meo
                              on mi.org_id = meo.org_id
                           where mi.enterprise_id =
                                 '0EA3756D964D21C3E054A0369F1934EC'
                             and meo.c_id =
                                 '0DE29484A7187032E054A0369F1934EC'
                             and me.is_leave = '1') ttt
            on mp.user_id = ttt.user_id
         where me.enterprise_code = 'PA000'
           and mp.is_leave = '1'
           and ttt.user_id is null
           and mp.created_date < ${today}) t1
  left join (select ${yesterday} as date_time,
                    count(distinct mp.user_id) agent_user
               from mln_emp mp
               join mln_identity mi
                 on mp.id_mln_emp = mi.id_mln_emp
               join (select meo.org_id,
                           meo.full_path,
                           split(meo.full_path,'/')[0] as p_id,
                           split(meo.full_path, '/')[1] as c_id
                      from mln_enterprise_org meo) meo
                 on mi.org_id = meo.org_id
              where mi.enterprise_id = '0EA3756D964D21C3E054A0369F1934EC'
                and meo.c_id = '0DE29484A7187032E054A0369F1934EC'
                and mp.is_leave = '1'
                and mp.created_date < ${today}) t2
    on t1.date_time = t2.date_time
  left join (select ${yesterday} as date_time,
                    count(t.user_id) total_zr_user
               from mln_user_info t
               left join (select mp.user_id
                           from mln_emp mp
                           join mln_enterprise me
                             on mp.enterprise_id = me.enterprise_id
                          where mp.is_leave = '1') tt
                 on t.user_id = tt.user_id
               join mln_login_session mls
                 on t.user_id = mls.user_id
              where tt.user_id is null
                and t.is_valid = '1'
                and t.created_date < ${today}) t3
    on t1.date_time = t3.date_time
  left join (select ${yesterday} as date_time,
                    count(distinct mll.user_id) pingan_active_user
               from mln_enterprise me
               join mln_emp mp
                 on me.enterprise_id = mp.enterprise_id
               left outer join (select distinct me.user_id
                                 from mln_emp me
                                 join mln_identity mi
                                   on me.id_mln_emp = mi.id_mln_emp
                                 join (select meo.org_id,
                                             meo.full_path,
                                             split(meo.full_path,'/')[0] as p_id,
                                             split(meo.full_path, '/')[1] as c_id
                                        from mln_enterprise_org meo) meo
                                   on mi.org_id = meo.org_id
                                where mi.enterprise_id =
                                      '0EA3756D964D21C3E054A0369F1934EC'
                                  and meo.c_id =
                                      '0DE29484A7187032E054A0369F1934EC'
                                  and me.is_leave = '1') ttt
                 on mp.user_id = ttt.user_id
               join mln_log_login mll
                 on mp.user_id = mll.user_id
              where me.enterprise_code = 'PA000'
                and mp.is_leave = '1'
                and ttt.user_id is null
                and mll.login_date >= ${before_30days}
                and mll.login_date < ${today}) t4
    on t1.date_time = t4.date_time
  left join (select ${yesterday} as date_time,
                    count(distinct mll.user_id) agent_active_user
               from mln_emp mp
               join mln_identity mi
                 on mp.id_mln_emp = mi.id_mln_emp
               join (select meo.org_id,
                           meo.full_path,
                           split(meo.full_path,'/')[0] as p_id,
                           split(meo.full_path, '/')[1] as c_id
                      from mln_enterprise_org meo) meo
                 on mi.org_id = meo.org_id
               join mln_log_login mll
                 on mp.user_id = mll.user_id
              where mi.enterprise_id = '0EA3756D964D21C3E054A0369F1934EC'
                and meo.c_id = '0DE29484A7187032E054A0369F1934EC'
                and mp.is_leave = '1'
                and mll.login_date >= ${before_30days}
                and mll.login_date < ${today}) t5
    on t1.date_time = t5.date_time
  left join (select ${yesterday} as date_time,
                    count(distinct mll.user_id) zr_active_user
               from mln_user_info t
               left join (select mp.user_id
                           from mln_emp mp
                           join mln_enterprise me
                             on mp.enterprise_id = me.enterprise_id
                          where mp.is_leave = '1') tt
                 on t.user_id = tt.user_id
               join mln_login_session mls
                 on t.user_id = mls.user_id
               join mln_log_login mll
                 on t.user_id = mll.user_id
              where tt.user_id is null
                and t.is_valid = '1'
                and mll.login_date >= ${before_30days}
                and mll.login_date < ${today}) t6
    on t1.date_time = t6.date_time
    left join (select ${yesterday} as date_time,
               count(distinct mp.user_id) pingan_valid_user
          from mln_enterprise me
          join mln_emp mp
            on me.enterprise_id = mp.enterprise_id
          left outer join (select distinct me.user_id
                            from mln_emp me
                            join mln_identity mi
                              on me.id_mln_emp = mi.id_mln_emp
                            join (select meo.org_id,
                                        meo.full_path,
                                        split(meo.full_path,'/')[0] as p_id,
                                        split(meo.full_path, '/')[1] as c_id
                                   from mln_enterprise_org meo) meo
                              on mi.org_id = meo.org_id
                           where mi.enterprise_id =
                                 '0EA3756D964D21C3E054A0369F1934EC'
                             and meo.c_id =
                                 '0DE29484A7187032E054A0369F1934EC'
                             and me.is_leave = '1') ttt
            on mp.user_id = ttt.user_id
          join mln_login_session mls
            on mp.user_id = mls.user_id
         where me.enterprise_code = 'PA000'
           and mp.is_leave = '1'
           and ttt.user_id is null
           and cast(regexp_replace(mls.ver_within_no, '\\\\.', '') as int) >= 350
           and mp.created_date < ${today}) t7
           on  t1.date_time = t7.date_time
  left join (select ${yesterday} as date_time, (t11.app_user + t22.pw001_user) agent_valid_user
  from (select count(distinct mp.user_id) app_user
  from mln_emp mp
  join mln_identity mi
    on mp.id_mln_emp = mi.id_mln_emp
  join (select meo.org_id,
               meo.full_path,
               split(meo.full_path,'/')[0] as p_id,
               split(meo.full_path, '/')[1] as c_id
          from mln_enterprise_org meo) meo
    on mi.org_id = meo.org_id
     join mln_login_session mls
    on mp.user_id = mls.user_id
 where mi.enterprise_id = '0EA3756D964D21C3E054A0369F1934EC'
   and meo.c_id = '0DE29484A7187032E054A0369F1934EC'
   and mp.is_leave = '1'
   and cast(regexp_replace(mls.ver_within_no, '\\\\.', '') as int) >= 350
   and mp.created_date < ${today}) t11,
       (select count(distinct mp.user_id) pw001_user
  from mln_enterprise me
  join mln_emp mp
    on me.enterprise_id = mp.enterprise_id
  join mln_login_session mls
    on mp.user_id = mls.user_id
 where mp.is_leave = '1'
   and mp.created_date < ${today}
   and mls.ver_within_no = '2.4.0') t22) t8
    on t1.date_time = t8.date_time
  left join (select ${yesterday} as date_time,
                    count(t.user_id) zr_valid_user
               from mln_user_info t
               left join (select mp.user_id
                           from mln_emp mp
                           join mln_enterprise me
                             on mp.enterprise_id = me.enterprise_id
                          where mp.is_leave = '1') tt
                 on t.user_id = tt.user_id
               join mln_login_session mls
                 on t.user_id = mls.user_id
              where tt.user_id is null
                and t.is_valid = '1'
                and cast(regexp_replace(mls.ver_within_no, '\\\\.', '') as int) >= 350
                and t.created_date < ${today}) t9
    on t1.date_time = t9.date_time
  left join (select ${yesterday} as date_time,
                    count(distinct mll.user_id) pingan_valid_active_user
               from mln_enterprise me
               join mln_emp mp
                 on me.enterprise_id = mp.enterprise_id
               left outer join (select distinct me.user_id
                                 from mln_emp me
                                 join mln_identity mi
                                   on me.id_mln_emp = mi.id_mln_emp
                                 join (select meo.org_id,
                                             meo.full_path,
                                             split(meo.full_path,'/')[0] as p_id,
                                             split(meo.full_path, '/')[1] as c_id
                                        from mln_enterprise_org meo) meo
                                   on mi.org_id = meo.org_id
                                where mi.enterprise_id =
                                      '0EA3756D964D21C3E054A0369F1934EC'
                                  and meo.c_id =
                                      '0DE29484A7187032E054A0369F1934EC'
                                  and me.is_leave = '1') ttt
                 on mp.user_id = ttt.user_id
               join mln_login_session mls
                 on mp.user_id = mls.user_id
               join mln_log_login mll
                 on mp.user_id = mll.user_id
              where me.enterprise_code = 'PA000'
                and mp.is_leave = '1'
                and ttt.user_id is null
                and cast(regexp_replace(mls.ver_within_no, '\\\\.', '') as int) >= 350
                and mll.login_date >= ${before_30days}
                and mll.login_date < ${today}) t10
    on t1.date_time = t10.date_time
  left join (select ${yesterday} as date_time, (t111.app_active_user + t222.pw001_acitve_user) agent_valid_active_user
  from (select count(distinct mll.user_id) app_active_user
  from mln_emp mp
  join mln_identity mi
    on mp.id_mln_emp = mi.id_mln_emp
  join (select meo.org_id,
               meo.full_path,
               split(meo.full_path,'/')[0] as p_id,
               split(meo.full_path, '/')[1] as c_id
          from mln_enterprise_org meo) meo
    on mi.org_id = meo.org_id
     join mln_login_session mls
    on mp.user_id = mls.user_id
join mln_log_login mll
on mp.user_id = mll.user_id
where mi.enterprise_id = '0EA3756D964D21C3E054A0369F1934EC'
   and meo.c_id = '0DE29484A7187032E054A0369F1934EC'
   and mp.is_leave = '1'
   and cast(regexp_replace(mls.ver_within_no, '\\\\.', '') as int) >= 350
and mll.login_date >= ${before_30days}
and mll.login_date < ${today}) t111,
       (select count(distinct mll.user_id) pw001_acitve_user
  from mln_enterprise me
  join mln_emp mp
    on me.enterprise_id = mp.enterprise_id
  join mln_login_session mls
    on mp.user_id = mls.user_id
join mln_log_login mll
on mp.user_id = mll.user_id
 where mp.is_leave = '1'
and mll.login_date >= ${before_30days}
and mll.login_date < ${today}
   and mls.ver_within_no = '2.4.0') t222) t11
    on t1.date_time = t11.date_time
  left join (select ${yesterday} as date_time,
                    count(distinct mll.user_id) zr_valid_active_user
               from mln_user_info t
               left join (select mp.user_id
                           from mln_emp mp
                           join mln_enterprise me
                             on mp.enterprise_id = me.enterprise_id
                          where mp.is_leave = '1') tt
                 on t.user_id = tt.user_id
               join mln_login_session mls
                 on t.user_id = mls.user_id
               join mln_log_login mll
                 on t.user_id = mll.user_id
              where tt.user_id is null
                and t.is_valid = '1'
                and cast(regexp_replace(mls.ver_within_no, '\\\\.', '') as int) >= 350
                and mll.login_date >= ${before_30days}
                and mll.login_date < ${today}) t12
    on t1.date_time = t12.date_time;"

hive -e "set mapred.job.queue.name=queue_1101_01;
         set hive.exec.parallel=true;
         use pndx_zn_safe;
         ${sql}" > ${file_name}

 

 

 

 

 

 

 

 

转载于:https://my.oschina.net/kyo4321/blog/827991

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值