国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網 會員登陸 & 注冊

hadoop

2023-06-14 14:41 作者:閉關修煉的庸人  | 我要投稿

?1.Hive分區(qū)創(chuàng)建表

Hive>create? table t_user_p(id int, name string)

Partitioned by (country string)

Row format delimited fields terminated by ‘,’;

2.mongoDB數據庫集合,文檔,查詢

(1)查看集合

from pymongo import MongoClient

class Test:

?????? def _ _init _ _(self):

?????????? self.client=MongoClient(’192.168.121.134’,27017)

??? ??? def getColl(self):

???????????? articledb = self.client[”articledb”]

???????????? collections=articledb.list_collection_names()

???????????? for collection in collections:

??????????????????? print(collection)

if _ _name _ _ ==’_ _main_ _’:

????????? test = Test()

?????????? test.getColl()

(2)創(chuàng)建集合

from pymongo import MongoClient

class Test:

?????? def _ _init _ _(self):

?????????? self.client=MongoClient(’192.168.121.134’,27017)

?????? def createColl(self):

???????????? articledb = self.client[”articledb”]

???????????? articledb.create_collection(”itcast”)

? if _ _name _ _ ==’_ _main_ _’:

??????? test = Test()

??????? test.createColl()

(3)刪除集合

from pymongo import MongoClient

class Test:

?????? def _ _init _ _(self):

?????????? self.client=MongoClient(’192.168.121.134’,27017)

?????? def dropColl(self):

??????????? articledb = self.client[”articledb”]

???????????? articledb.drop_collection(”itcast”)

? if _ _name _ _ ==’_ _main_ _’:

??????? test = Test()

??????? test.dropColl()

(3)查看文檔

from pymongo import MongoClient

class Test:

?????? def _ _init _ _(self):

?????????? self.client=MongoClient(’192.168.121.134’,27017)

?????? def findDoc(self):

??????????? self.articledb = self.client[”articledb”]

??????????? comment = self.articledb[”comment”]

?????????? documents = comment.find()

????????????????????????? for ?document in documents:

?????????????????? print( document)

? if _ _name _ _ ==’_ _main_ _’:

??????? test = Test()

??????? test.findDocl()

?


hadoop的評論 (共 條)

分享到微博請遵守國家法律
闸北区| 古浪县| 阳曲县| 洛隆县| 绥棱县| 潮州市| 栖霞市| 郎溪县| 铜山县| 扎兰屯市| 静海县| 永年县| 章丘市| 嵊州市| 天津市| 子长县| 雅安市| 大悟县| 尚志市| 杨浦区| 慈溪市| 菏泽市| 鸡东县| 施秉县| 宿松县| 黔西县| 左云县| 淮北市| 铜山县| 大同市| 监利县| 荣昌县| 永靖县| 武宁县| 当阳市| 宁乡县| 江西省| 莒南县| 呼伦贝尔市| 辛集市| 庆阳市|