摘要:linux环境 假设hdfs安装路径(例如是): /usr/hdp/hadoop/bin/hdfs 1. -ls 列出当前目录下的文件、文件夹 /usr/hdp/hadoop/bin/hdfs dfs -ls /apps/hive/warehouse/my_home 2. 查看文件,例如hive表的
阅读全文
摘要:1. 从已有的环境中,备份已经安装的package pip freeze > requirements.txt 2. pip安装requirements.txt的包(换源之后下载更快) pip install -r requirements.txt -i https://pypi.tuna.tsin
阅读全文
摘要:spark-submit提交任务的参数很多: Usage: spark-submit [options] <app jar | python file> [app arguments] Usage: spark-submit --kill [submission ID] --master [spar
阅读全文
摘要:1. distinct:去重 # distinct select distinct name_adress from my_test_copy; # 得到去重字段 select count(distinct name_adress) as distinct_rows from my_test_cop
阅读全文
摘要:1. 判断是否是空值 is not null 和 is null select * from XXX where column_name is not null; select * from XXX where column_1 is not null and column_2 is not nul
阅读全文
摘要:在mysql中,多个表查询出现错误:Every derived table must have its own alias 原因:中间表或者select产生的表,没有使用别名。 解决方法: 新产生的表加入别名: 例如: select * from select id, content from XX
阅读全文
摘要:在mysql中,多个表联合查询时,出现错误:[Err] 1060 - Duplicate column name 'XXX' 原因: 使用的是:select * 操作,造成了列名重复,例如a表里面有列名'content',b表里面也有列名'content',此时就会报错。 解决方法: 直接指定想要返
阅读全文
摘要:在mysql中,多个表关联查询时,出现错误:[Err] 1052 - Column 'school_province' in field list is ambiguous 原因: select 的字段中有相同的列名 'XXXXX',但是却没有指定这个列名时来自那哪一个表,于是冲突。 解决方法: 给
阅读全文
摘要:在navicat中导入*.xls数据时,出现错误:[Err] [Row1] [Imp] 1062 - Duplicate entry '1' for key 'PRIMARY' 原因: 因为我创建原始表的时候,设置了primary key为 id,并且自增。但是我的要导入的excel表里面也有一列时
阅读全文
摘要:python可以用于计算相对于某一个时间/日期的前一段时间或者后一段时间的时间格式数据。 主要用到 datetime 和 timedelta 模块。 from datetime import datetime, timedelta 1. 计算前一天 # 前一天 date_1 = datetime.n
阅读全文
摘要:python中,对于相同值的数据,地址是否一致?? 大概来说: 1. 对于整数、短字符串等值,在内存中只会有一份,也就是地址一致。 2. 对于元组、字典、列表、集合以及range、map等容器类对象,这些的类型的数据值即使看起来一样,内存地址也是不一样的。 3. 在同一个列表或者元组中,很大的整数在
阅读全文
摘要:1. in 和 not in —— 判断某个序列中是否存在某值 # in aa = [1,2,3,'Cathy','太平洋'] if '大西洋' in aa: print('yes') else: print('no') # no # not in if '大西洋' not in aa: print
阅读全文