问题:使用pyhive连接后使用pandas会预警,让使用sqlalchemy

方法:

from sqlalchemy.engine import create_engine
from .config import config

database_config = { 
    'host': config['HV_SVR'],
    'port': 10000,
    'auth': "CUSTOM",
    'database': config['HV_DB'],
    'user': config['HV_USER'],
    'password': config['HV_PASS']
}

阅读全文

问题:python如何连接hive数据仓库?

解决:使用pyhive

方法:

1、安装三个python包,网上有的说要安装sasl,但我没安装成功,然后发现不安装也可以

pip install thrift==0.20.0 thrift-sasl==0.4.3 pyhive==0.7.0

阅读全文

问题:如何获取视频时长

方法:

import os

cmd = 'ffmpeg -i %s 2>&1 | grep "Duration"' % input_file
out = os.popen(cmd).read()

注:这是最好的方法,不建议使用subprocess调用进程,有点卡

问题:linux生成随机密码,随机字符串

方法:

openssl rand -base64 12
openssl rand -hex 16

拓展:
使用pwgen模块,但需要先安装