import pymysql
import logging logger = logging.getLogger('app') class MysqlBase:
def __init__(self, **args):
self.host = args.get('host')
self.user = args.get('user')
self.pwd = args.get('pwd')
self.db = args.get('db')
self.port = int(args.get('port', 3306))
self.charset = args.get('charset', 'utf8') def __enter__(self):
try:
self.conn = pymysql.connect(
host=self.host,
user=self.user,
passwd=self.pwd,
db=self.db,
charset=self.charset,
port=self.port
)
self.cur = self.conn.cursor()
return self
except Exception as e:
raise ValueError('mysql connect error: {}'.format((self.host, e))) def __exit__(self, exc_type, exc_val, exc_tb):
self.cur.close()
self.conn.close() def query(self, sql, args=None):
try:
self.cur.execute(sql, args=args) # 执行sql语句
res = self.cur.fetchall() # 获取查询的所有记录
except Exception as e:
logger.error("query error: {}".format(e))
print("query error: {}".format(e))
raise e
return res def update(self, sql):
effect_rows = 0
try:
effect_rows = self.cur.execute(sql)
# 提交
self.conn.commit()
except Exception as e:
# 错误回滚
self.conn.rollback()
logger.error("update error: {}".format(e))
print("update error: {}".format(e))
return effect_rows if __name__ == "__main__":
with MysqlBase(host='10.51.1.37', port=3306, user='root', pwd='ysyhl9T!') as db:
res = db.query(
"select user,authentication_string from mysql.user where user='whisky2' group by authentication_string;")
print(res)
#!/usr/bin/env python
# -*-coding:utf-8-*-
'''
role : mysql操作
''' import pymysql
from opssdk.logs import Log class MysqlBase:
def __init__(self, **args):
self.host = args.get('host')
self.user = args.get('user')
self.pswd = args.get('passwd')
self.db = args.get('db')
self.port = int(args.get('port', 3306))
self.charset = args.get('charset', 'utf8') log_path = '/log/yunwei/yunwei_mysql.log'
self.log_ins = Log('', log_path)
try:
self.conn = pymysql.connect(host=self.host, user=self.user,
password=self.pswd, db=self.db, port=self.port, charset=self.charset)
self.cur = self.conn.cursor()
except:
raise ValueError('mysql connect error {0}'.format(self.host)) ###释放资源
def __del__(self):
self.cur.close()
self.conn.close() def __exit__(self, exc_type, exc_val, exc_tb):
self.cur.close()
self.conn.close() ### 查询
def query(self, sql):
try:
self.cur.execute(sql) # 执行sql语句
res = self.cur.fetchall() # 获取查询的所有记录
except Exception as e:
self.log_ins.write_log("error", e)
raise e return res def change(self, sql):
resnum = 0
try:
resnum = self.cur.execute(sql)
# 提交
self.conn.commit()
except Exception as e:
# 错误回滚
self.log_ins.write_log("error", e)
self.conn.rollback()
return resnum
#!/usr/bin/env python
# -*-coding:utf-8 -*-
#
# 无法执行多个query,self.conn.close()放在CdbConn类的单独函数中,每次query之后要手动close;否则多次query,会自动关闭
import pymysql class CdbConn():
def __init__(self, db_host, db_user, db_pwd, db_name, db_port=3306):
self.db_host = db_host
self.db_port = db_port
self.db_user = db_user
self.db_pwd = db_pwd
self.db_name = db_name
self.status = True
self.conn = self.getConnection() def getConnection(self):
try:
conn = pymysql.Connect(
host=self.db_host, # 设置MYSQL地址
port=int(self.db_port), # 设置端口号
user=self.db_user, # 设置用户名
passwd=self.db_pwd, # 设置密码
db=self.db_name, # 数据库名
charset='utf8', # 设置编码
use_unicode=True
)
return conn
except Exception as e:
self.status = False
print('数据库连接异常: ', e) def query(self, sqlString):
cursor = self.conn.cursor()
cursor.execute(sqlString)
returnData = cursor.fetchall()
cursor.close()
# self.conn.close()
return returnData def close(self):
self.conn.close() def update(self, sqlString):
cursor = self.conn.cursor()
cursor.execute(sqlString)
self.conn.commit()
cursor.close()
# self.conn.close()

v2改进版本: https://www.cnblogs.com/blueskyyj/p/10039972.html

# !/usr/bin/env python
# -*-coding:utf-8 -*-
# 多次调用query之后,要手动调用close方法关闭db连接
import pymysql class CdbConn():
def __init__(self, db_host, db_user, db_pwd, db_name, db_port=3306):
self.db_host = db_host
self.db_port = db_port
self.db_user = db_user
self.db_pwd = db_pwd
self.db_name = db_name
self.status = True
self.conn = self.getConnection() def getConnection(self):
try:
conn = pymysql.Connect(
host=self.db_host, # 设置MYSQL地址
port=int(self.db_port), # 设置端口号
user=self.db_user, # 设置用户名
passwd=self.db_pwd, # 设置密码
db=self.db_name, # 数据库名
charset='utf8', # 设置编码
use_unicode=True
)
return conn
except Exception as e:
self.status = False
print('数据库连接异常:{}, detail: {} '.format(
e, (self.db_host, self.db_name)))
return None def query(self, sqlString):
cursor = self.conn.cursor()
try:
cursor.execute(sqlString)
returnData = cursor.fetchall()
return returnData
except Exception as e:
print("fetch failed, detail:{}".format(e))
finally:
if cursor:
cursor.close() # 多个cursor不能同时存在? https://blog.csdn.net/emaste_r/article/details/75068902
# self.conn.close() # 调用close方法关闭db连接 def update(self, sqlString):
cursor = self.conn.cursor()
try:
cursor.execute(sqlString)
self.conn.commit()
except Exception as e:
self.conn.rollback()
print("update failed, detail:{}".format(e))
finally:
if cursor:
cursor.close()
# self.conn.close() # 需先判断数据库连接是否存在 if self.conn: ,再调用close方法关闭db连接 def close(self):
if self.conn:
self.conn.close() if __name__ == "__main__":
db = CdbConn(db_host='10.51.1.37', db_port=3306, db_name='information_schema', db_user='root', db_pwd='ysyhl9T!')
db2 = CdbConn(db_host='10.51.1.37', db_port=3306, db_name='information_schema', db_user='root', db_pwd='ysyhl9T!')
tt = db.query("show databases")
ss = db.query("show databases")
# dd = db2.query("show tables from mysql")
print(tt)
print(ss)
# print(dd)
# -*- coding: UTF-8 -*- 

import MySQLdb
import MySQLdb.cursors
import logging
from django.db import connection
import traceback
logger = logging.getLogger('default')
import json class Dao(object):
_CHART_DAYS = 90 # 测试指定的mysql实例连接是否成功
def check_mysql_connect(self, ipaddress, mysqlport, username, password):
listDb = []
conn = None
cursor = None
connectflag=2 try:
conn = MySQLdb.connect(host=ipaddress, port=mysqlport, user=username, passwd=password,
charset='utf8',connect_timeout=10)
cursor = conn.cursor()
sql = "show databases"
n = cursor.execute(sql)
listDb = [row[0] for row in cursor.fetchall()
if row[0] not in ('information_schema', 'performance_schema', 'mysql', 'test')]
connectflag=1
except MySQLdb.Warning as w:
traceback.print_exc()
#raise Exception(w)
except MySQLdb.Error as e:
traceback.print_exc()
#raise Exception(e)
finally:
if cursor is not None:
cursor.close()
if conn is not None:
conn.commit()
conn.close()
return connectflag # 检查复制同步状态
def check_slave_status(self, ipaddress, mysqlport, username, password):
listDb = []
conn = None
cursor = None master_host='NOHOST'
master_port=0
master_user=''
master_log_file=''
read_master_log_pos=0
relay_master_log_file=''
exec_master_log_pos=0
slave_io_running='No'
slave_sql_running='No'
seconds_behind_master=-1
count=0
io_succesed_count=0
sql_successed_count=0
try:
conn = MySQLdb.connect(host=ipaddress, port=mysqlport, user=username, passwd=password,
charset='utf8', connect_timeout=10, cursorclass=MySQLdb.cursors.DictCursor)
cursor = conn.cursor()
sql = "show slave status"
n = cursor.execute(sql)
for row in cursor.fetchall():
count = count +1
master_host=row['Master_Host']
master_port=row['Master_Port']
master_user = row['Master_User']
master_log_file = row['Master_Log_File']
read_master_log_pos = row['Read_Master_Log_Pos']
relay_master_log_file = row['Relay_Master_Log_File']
exec_master_log_pos = row['Exec_Master_Log_Pos']
cur_slave_io_running = row['Slave_IO_Running']
cur_slave_sql_running = row['Slave_SQL_Running']
cur_seconds_behind_master = row['Seconds_Behind_Master']
if (cur_slave_io_running == 'Yes'):
io_succesed_count = io_succesed_count + 1
if (cur_slave_sql_running == 'Yes'):
sql_successed_count = sql_successed_count + 1
if (cur_seconds_behind_master == 'NULL'):
seconds_behind_master = -1
elif (cur_seconds_behind_master > seconds_behind_master):
seconds_behind_master = cur_seconds_behind_master
if ( io_succesed_count == count ):
slave_io_running = 'Yes'
if ( sql_successed_count == count ):
slave_sql_running = 'Yes'
if (count == 0 ):
slave_io_running = 'No'
slave_sql_running = 'No'
except MySQLdb.Warning as w:
traceback.print_exc()
#raise Exception(w)
except MySQLdb.Error as e:
traceback.print_exc()
#raise Exception(e)
finally:
if cursor is not None:
cursor.close()
if conn is not None:
conn.commit()
conn.close()
return (master_host,master_port,master_user,master_log_file,read_master_log_pos,relay_master_log_file,exec_master_log_pos,slave_io_running,slave_sql_running,seconds_behind_master) # 检查库表数量
def check_table_num(self, ipaddress, mysqlport, username, password):
listDb = []
conn = None
cursor = None dbnum = 0
tablenum = 0
try:
conn = MySQLdb.connect(host=ipaddress, port=mysqlport, user=username, passwd=password,
charset='utf8', cursorclass=MySQLdb.cursors.DictCursor)
conn.select_db('information_schema')
cursor = conn.cursor()
sql = "select count(*) dbnum from SCHEMATA where SCHEMA_NAME not in ('information_schema','mysql','performance_schema','sys')"
effect_row = cursor.execute(sql)
row = cursor.fetchone()
dbnum = row['dbnum']
sql = "select count(*) tablenum from TABLES where TABLE_SCHEMA not in ('information_schema','mysql','performance_schema','sys')"
effect_row = cursor.execute(sql)
row = cursor.fetchone()
tablenum = row['tablenum']
except MySQLdb.Warning as w:
traceback.print_exc()
# raise Exception(w)
except MySQLdb.Error as e:
traceback.print_exc()
# raise Exception(e)
finally:
if cursor is not None:
cursor.close()
if conn is not None:
conn.commit()
conn.close()
return (dbnum,tablenum) # 连进指定的mysql实例里,读取所有databases并返回
def getAlldbByCluster(self, masterHost, masterPort, masterUser, masterPassword):
listDb = []
conn = None
cursor = None try:
conn = MySQLdb.connect(host=masterHost, port=masterPort, user=masterUser, passwd=masterPassword,
charset='utf8')
cursor = conn.cursor()
sql = "show databases"
n = cursor.execute(sql)
listDb = [row[0] for row in cursor.fetchall()
if row[0] not in ('information_schema', 'performance_schema', 'mysql', 'test')]
except MySQLdb.Warning as w:
raise Exception(w)
except MySQLdb.Error as e:
raise Exception(e)
finally:
if cursor is not None:
cursor.close()
if conn is not None:
conn.commit()
conn.close()
return listDb # 连进指定的mysql实例里,读取所有tables并返回
def getAllTableByDb(self, masterHost, masterPort, masterUser, masterPassword, dbName):
listTb = []
conn = None
cursor = None try:
conn = MySQLdb.connect(host=masterHost, port=masterPort, user=masterUser, passwd=masterPassword, db=dbName,
charset='utf8')
cursor = conn.cursor()
sql = "show tables"
n = cursor.execute(sql)
listTb = [row[0] for row in cursor.fetchall()
if row[0] not in (
'test')]
except MySQLdb.Warning as w:
raise Exception(w)
except MySQLdb.Error as e:
raise Exception(e)
finally:
if cursor is not None:
cursor.close()
if conn is not None:
conn.commit()
conn.close()
return listTb # 连进指定的mysql实例里,读取所有Columns并返回
def getAllColumnsByTb(self, masterHost, masterPort, masterUser, masterPassword, dbName, tbName):
listCol = []
conn = None
cursor = None try:
conn = MySQLdb.connect(host=masterHost, port=masterPort, user=masterUser, passwd=masterPassword, db=dbName,
charset='utf8')
cursor = conn.cursor()
sql = "SELECT COLUMN_NAME FROM information_schema.COLUMNS WHERE TABLE_SCHEMA='%s' AND TABLE_NAME='%s';" % (
dbName, tbName)
n = cursor.execute(sql)
listCol = [row[0] for row in cursor.fetchall()]
except MySQLdb.Warning as w:
raise Exception(w)
except MySQLdb.Error as e:
raise Exception(e)
finally:
if cursor is not None:
cursor.close()
if conn is not None:
conn.commit()
conn.close()
return listCol # 连进指定的mysql实例里,执行sql并返回
def mysql_query(self, masterHost, masterPort, masterUser, masterPassword, dbName, sql, limit_num=0):
result = {'column_list': [], 'rows': [], 'effect_row': 0}
conn = None
cursor = None try:
conn = MySQLdb.connect(host=masterHost, port=masterPort, user=masterUser, passwd=masterPassword, db=dbName,
charset='utf8')
cursor = conn.cursor()
effect_row = cursor.execute(sql)
if int(limit_num) > 0:
rows = cursor.fetchmany(size=int(limit_num))
else:
rows = cursor.fetchall()
fields = cursor.description column_list = []
if fields:
for i in fields:
column_list.append(i[0])
result = {}
result['column_list'] = column_list
result['rows'] = rows
result['effect_row'] = effect_row except MySQLdb.Warning as w:
logger.warning(str(w))
result['Warning'] = str(w)
except MySQLdb.Error as e:
logger.error(str(e))
result['Error'] = str(e)
finally:
if cursor is not None:
cursor.close()
if conn is not None:
try:
conn.rollback()
conn.close()
except:
conn.close()
return result # 连进指定的mysql实例里,执行sql并返回
def mysql_execute(self, masterHost, masterPort, masterUser, masterPassword, dbName, sql):
result = {}
conn = None
cursor = None try:
conn = MySQLdb.connect(host=masterHost, port=masterPort, user=masterUser, passwd=masterPassword, db=dbName,
charset='utf8')
cursor = conn.cursor()
effect_row = cursor.execute(sql)
# result = {}
# result['effect_row'] = effect_row
conn.commit()
except MySQLdb.Warning as w:
logger.warning(str(w))
result['Warning'] = str(w)
except MySQLdb.Error as e:
logger.error(str(e))
result['Error'] = str(e)
finally:
if result.get('Error') or result.get('Warning'):
conn.close()
elif cursor is not None:
cursor.close()
conn.close()
return result def getWorkChartsByMonth(self):
cursor = connection.cursor()
sql = "select date_format(create_time, '%%m-%%d'),count(*) from sql_workflow where create_time>=date_add(now(),interval -%s day) group by date_format(create_time, '%%m-%%d') order by 1 asc;" % (
Dao._CHART_DAYS)
cursor.execute(sql)
result = cursor.fetchall()
return result def getWorkChartsByPerson(self):
cursor = connection.cursor()
sql = "select engineer, count(*) as cnt from sql_workflow where create_time>=date_add(now(),interval -%s day) group by engineer order by cnt desc limit 50;" % (
Dao._CHART_DAYS)
cursor.execute(sql)
result = cursor.fetchall()
return result # 取出otter中的频道、管道、cannal相关信息
def get_otter_pipeline_infos(self, ipaddress, mysqlport, username, password,dbname):
otter_pipeline_info_dict_list = []
conn = None
cursor = None try:
conn = MySQLdb.connect(host=ipaddress, port=mysqlport, user=username, passwd=password,db=dbname,
charset='utf8', connect_timeout=10, cursorclass=MySQLdb.cursors.DictCursor)
cursor = conn.cursor()
sql = """SELECT c.ID channelid ,c.`NAME` channelname ,p.ID pipelineid ,p.`NAME` pipelinename ,p.PARAMETERS pipelineparams
FROM CHANNEL c,PIPELINE p
where c.id = p.CHANNEL_ID
order by c.ID
"""
n = cursor.execute(sql)
for row in cursor.fetchall():
otter_pipeline_info_dict={}
otter_pipeline_info_dict["channelid"] = row['channelid']
otter_pipeline_info_dict["channelname"] = row['channelname']
otter_pipeline_info_dict["pipelineid"] = row['pipelineid']
otter_pipeline_info_dict["pipelinename"] = row['pipelinename']
pipelineparams=row['pipelineparams']
jsonmsg=json.loads(pipelineparams)
canalname=jsonmsg['destinationName']
otter_pipeline_info_dict["canalname"] = canalname
otter_pipeline_info_dict_list.append(otter_pipeline_info_dict)
except MySQLdb.Warning as w:
traceback.print_exc()
#raise Exception(w)
except MySQLdb.Error as e:
traceback.print_exc()
#raise Exception(e)
finally:
if cursor is not None:
cursor.close()
if conn is not None:
conn.commit()
conn.close()
return otter_pipeline_info_dict_list

MySQLDB dao封装

https://www.cnblogs.com/wardensky/p/4783010.html

#coding=utf-8
#!/usr/bin/python import pymysql class MYSQL:
"""
对pymysql的简单封装
"""
def __init__(self,host,user,pwd,db):
self.host = host
self.user = user
self.pwd = pwd
self.db = db def __GetConnect(self):
"""
得到连接信息
返回: conn.cursor()
"""
if not self.db:
raise(NameError,"没有设置数据库信息")
self.conn = pymysql.connect(host=self.host,user=self.user,password=self.pwd,database=self.db,charset="utf8")
cur = self.conn.cursor()
if not cur:
raise(NameError,"连接数据库失败")
else:
return cur def ExecQuery(self,sql):
"""
执行查询语句
返回的是一个包含tuple的list,list的元素是记录行,tuple的元素是每行记录的字段 调用示例:
ms = MYSQL(host="localhost",user="sa",pwd="123456",db="PythonWeiboStatistics")
resList = ms.ExecQuery("SELECT id,NickName FROM WeiBoUser")
for (id,NickName) in resList:
print str(id),NickName
"""
cur = self.__GetConnect()
cur.execute(sql)
resList = cur.fetchall() #查询完毕后必须关闭连接
self.conn.close()
return resList def ExecNonQuery(self,sql):
"""
执行非查询语句 调用示例:
cur = self.__GetConnect()
cur.execute(sql)
self.conn.commit()
self.conn.close()
"""
cur = self.__GetConnect()
cur.execute(sql)
self.conn.commit()
self.conn.close() def main(): mysql = MYSQL(host="192.168.163.36",user="wisdomhr",pwd="wisdomhr",db="WISDOMHR")
resList = mysql.ExecQuery("SELECT CITY FROM RES_SCHOOL")
for inst in resList:
print(inst)
if __name__ == '__main__':
main()
# 调用:
#!/usr/bin/python #version 3.4 import wispymysql mysql = wispymysql.MYSQL(host="192.168.163.36",user="wisdomhr",pwd="wisdomhr",db="WISDOMHR")
selectsql = "SELECT ID, CITY FROM RES_SCHOOL WHERE CITY LIKE '%\r\n%'"
result = mysql.ExecQuery(selectsql) for (dbid, city) in result:
rightcity = city.replace('\r\n','')
updatesql= "UPDATE RES_SCHOOL SET CITY = '" + rightcity + "' WHERE ID = " + str(dbid)
print(updatesql)
mysql.ExecNonQuery(updatesql)

http://justcode.ikeepstudying.com/2019/01/python%EF%BC%9Amysql%E8%BF%9E%E5%BA%93%E5%8F%8A%E7%AE%80%E5%8D%95%E5%B0%81%E8%A3%85%E4%BD%BF%E7%94%A8-python-mysql%E6%93%8D%E4%BD%9C%E7%B1%BB/

pymysql DAO简单封装的更多相关文章

  1. 对pymysql的简单封装

    #coding=utf-8 #!/usr/bin/python import pymysql class MYSQL: """ 对pymysql的简单封装 "& ...

  2. Spring jdbc 对象Mapper的简单封装

    一般查询实体的时候,都需要这么使用/**      * 根据id查询      *       * @return      */     public Emp queryEmpById(Intege ...

  3. SSM 关于service和dao的封装

    近期由于客户需求,所以我们整个小组开始开发java项目. 虽然很久以前也是系统学习过.不过干了这么多年 .net  ,有关java的早就扔了. 好了,废话不多说.我们看看SSM 关于service和d ...

  4. Android AsyncTask 深度理解、简单封装、任务队列分析、自定义线程池

    前言:由于最近在做SDK的功能,需要设计线程池.看了很多资料不知道从何开始着手,突然发现了AsyncTask有对线程池的封装,so,就拿它开刀,本文将从AsyncTask的基本用法,到简单的封装,再到 ...

  5. FMDB简单封装和使用

    工具:火狐浏览器+SQLite Manager插件 ; Xcode; FMDB库; 效果: 项目地址: https://github.com/sven713/PackFMDB 主要参考这两篇博客: 1 ...

  6. Android--Retrofit+RxJava的简单封装(三)

    1,继续接着上一篇的讲讲,话说如果像上一篇这样的话,那么我们每一次请求一个结构都要创建一堆的Retrofit对象,而且代码都是相同的,我们可以试试封装一下 先创建一个HttpMethods类,将Ret ...

  7. okhttp3 get post 简单封装

    最近打算在新项目中使用 okhttp3, 简单封装了一下异步 get post 因为 CallBack 也是在子线程中执行,所以用到了 Handler public class MyOkHttpCli ...

  8. python网页请求urllib2模块简单封装代码

    这篇文章主要分享一个python网页请求模块urllib2模块的简单封装代码. 原文转自:http://www.jbxue.com/article/16585.html 对python网页请求模块ur ...

  9. iOS开发——UI篇OC篇&UITableView简单封装

    UITableView简单封装 UITableView时iOS开发中使用最多也是最重的一个UI空间,其实在App Store里面的%80以上的应用都用到了这个控件,所以就给大家介绍一下,前面的文章中也 ...

随机推荐

  1. css实现硬件加速

    原文请点击一下链接: http://blog.teamtreehouse.com/increase-your-sites-performance-with-hardware-accelerated-c ...

  2. npm中的学习课程

    我也不知道叫什么名字好 进入 https://nodeschool.io/zh-cn/,你能够看到许多课程. 这些课程大多面向零基础的,非常有趣(类似于许多关卡的小游戏). 快速开始 首先,确定你的电 ...

  3. LeetCode 1102. Path With Maximum Minimum Value

    原题链接在这里:https://leetcode.com/problems/path-with-maximum-minimum-value/ 题目: Given a matrix of integer ...

  4. Greenplum常用的gp_toolkit & pg_catalog监控语句

    gp_toolkit 说明 Greenplum数据库提供了一个名为gp_tooikit的管理schema,该schema下有关于查询系统目录,日志文件, 用户创建(databases,schema,t ...

  5. Windbg妙用

    计算器 当你在调试,需要做一些从十六进制到十进制的简单转换,一些整数计算你不需要切换到calc.exe,你可以只使用windbg的表达式计算器.假设你得到了一个十六进制的大小,比如说2e903000, ...

  6. 集成omnibus-ctl+ chef 制作一个可配置的软件包

    前边有写过使用omnibus-ctl 制作软件包的,但是当时没有集成chef,只有一个空壳子,实际上omnibus-ctl 已经内置 了对于chef 的操作(但是我们还需要在添加一个依赖),以下简单说 ...

  7. HTML相对路径和绝对路径

     一.相对路径 相对路径不带有盘符,通常是以HTML网页文件为起点,通过层级关系描述目标图像的位置. 相对于文件自身出发,就是相对路径. 主要有以下几种情况:   ①文件和图片(html文档)在同一个 ...

  8. 如何解决数据类别不平衡问题(Data with Imbalanced Class)

    类别不平衡问题是指:在分类任务中,数据集中来自不同类别的样本数目相差悬殊. 类别不平衡问题会造成这样的后果:在数据分布不平衡时,其往往会导致分类器的输出倾向于在数据集中占多数的类别:输出多数类会带来更 ...

  9. [xms]西软xms试算平衡报表-穿透明细报表-增加储值卡卡号列

    只能呵呵哒 [xms]西软xms试算平衡报表-穿透明细报表-增加储值卡卡号列 pospay ' and hotelid='${hotelid}'; hhaccount ' and hotelid='$ ...

  10. Spark跑在Yarn上出现错误,原因是jdk的版本问题

    ./bin/spark-shell --master yarn 2019-07-01 12:20:13 WARN NativeCodeLoader:62 - Unable to load native ...