下载网站:www.SyncNavigator.CN 客服QQ1793040
----------------------------------------------------------
关于HKROnline SyncNavigator 注册机价格的问题
HKROnline SyncNavigator 8.4.1 非破解版 注册机 授权激活教程
最近一直在研究数据库同步的问题,在网上查了很多资料,也请教了很多人,找到了一种通过快照复制的方法。研究了一番后发现之前就是用的这个方法,效果不是很好,果断放弃。经过了一番寻觅和他人指点,最后从一位热心网友那里得知一款很好用的软件—— SyncNavigator。
好东西就要拿出来跟大家分享,所以今天向大家介绍一下这款软件,及其一些使用方法。下面先看看它有什么强大的功能吧!
SyncNavigator的基本功能:
自动同步数据/定时同步数据
无论是实时同步/24小时不间断同步,还是根据计划任务(每小时/每日/每周/等)定时自动同步都能完全胜任。
完整支持 Microsoft sql Server
完整支持 Microsoft sql Server 2000 2005 2008 数据库类型。并能在不同数据库版本之间相互同步数据。
支持 MysqL 4.1 以上版本
支持 MysqL 4.1 5.0 5.1 5.4 5.5。并能在不同数据库版本之间相互同步数据。
无人值守和故障自动恢复
当数据库故障或网络故障以后,无需人工干预(或 *** 作)自动恢复同步并确保数据完全准确,可靠。
同构数据库同步/异构数据库同步
sql Server to sql Server, MysqL to MysqL, sql Server to MysqL 等都能轻松实现。
断点续传和增量同步
当同步完成(或中断)后,再次同步时能继续上一次的位置增量同步,避免每次都需要从头开始的问题。
最近这几天准备介绍一下 Python 与三大数据库的使用,这是第一篇,首先来介绍 MongoDB 吧,这里介绍 MongoDB 的两款 *** 作库,走起!!
MongoDB GUI 工具首先介绍一款 MongoDB 的 GUI 工具 Robo 3T,初学 MongoDB 用这个来查看数据真的很爽。可以即时看到数据的增删改查,不用 *** 作命令行来查看。
PyMongo(同步)PyMongo 是一个同步 *** 作的数据存储库。可能大家都对 PyMongo 比较熟悉了,这里就简单介绍它的增删改查等 *** 作。
连接# 普通连接clIEnt = MongoClIEnt('localhost', 27017) clIEnt = MongoClIEnt('mongodb://localhost:27017/') # # 密码连接 clIEnt = MongoClIEnt('mongodb://username:password@localhost:27017/dbname') db = clIEnt.zfdb # db = clIEnt['zfdb'] test = db.test
增# 增加一条记录person = {'name': 'zone','sex':'boy'} person_ID = test.insert_one(person).inserted_ID print(person_ID)
# 批量插入persons = [{'name': 'zone', 'sex': 'boy'}, {'name': 'zone1', 'sex': 'boy1'}] result = test.insert_many(persons) print(result.inserted_IDs)
删# 删除单条记录result1 = test.delete_one({'name': 'zone'}) pprint.pprint(result1)
# 批量删除result1 = test.delete_many({'name': 'zone'}) pprint.pprint(result1)
改# 更新单条记录res = test.update_one({'name': 'zone'}, {'$set': {'sex': 'girl girl'}}) print(res.matched_count)
# 更新多条记录test.update_many({'name': 'zone'}, {'$set': {'sex': 'girl girl'}})
查# 查找多条记录pprint.pprint(test.find()) # 添加查找条件 pprint.pprint(test.find({"sex": "boy"}).sort("name"))
聚合如果你是我的老读者,那么你肯定知道我之前的骚 *** 作,就是用爬虫爬去数据之后,用聚合统计结合可视化图表进行数据展示。
aggs = [ {"$match": {"$or" : [{"fIEld1": {"$regex": "regex_str"}}, {"fIEld2": {"$regex": "regex_str"}}]}}, # 正则匹配字段 {"$project": {"fIEld3":1, "fIEld4":1}},# 筛选字段 {"$group": {"_ID": {"fIEld3": "$fIEld3", "fIEld4":"$fIEld4"}, "count": {"$sum": 1}}}, # 聚合 *** 作 ] result = test.aggregate(pipeline=aggs)
例子:以分组的方式统计 sex 这个关键词出现的次数,说白了就是统计有多少个男性,多少个女性。
test.aggregate([{'$group': {'_ID': '$sex', 'weight': {'$sum': 1}}}])
聚合效果图:(秋招季,用Python分析深圳程序员工资有多高?
)文章配图)
Python 工年限要求
Python 学历要求 Motor(异步)Motor 是一个异步实现的 MongoDB 存储库 Motor 与 Pymongo 的配置基本类似。连接对象就由 MongoClIEnt 变为 AsyncIOMotorClIEnt 了。下面进行详细介绍一下。
连接# 普通连接clIEnt = motor.motor_asyncio.AsyncIOMotorClIEnt('mongodb://localhost:27017') # 副本集连接 clIEnt = motor.motor_asyncio.AsyncIOMotorClIEnt('mongodb://host1,host2/?replicaset=my-replicaset-name') # 密码连接 clIEnt = motor.motor_asyncio.AsyncIOMotorClIEnt('mongodb://username:password@localhost:27017/dbname') # 获取数据库 db = clIEnt.zfdb # db = clIEnt['zfdb'] # 获取 collection collection = db.test # collection = db['test']
增加一条记录添加一条记录。
async def do_insert(): document = {'name': 'zone','sex':'boy'} result = await db.test_collection.insert_one(document) print('result %s' % repr(result.inserted_ID)) loop = asyncio.get_event_loop() loop.run_until_complete(do_insert())
增加一条记录 批量增加记录添加结果如图所暗示。
async def do_insert(): result = await db.test_collection.insert_many( [{'name': i, 'sex': str(i + 2)} for i in range(20)]) print('inserted %d docs' % (len(result.inserted_IDs),)) loop = asyncio.get_event_loop() loop.run_until_complete(do_insert())
批量增加记录 查找一条记录async def do_find_one(): document = await db.test_collection.find_one({'name': 'zone'}) pprint.pprint(document) loop = asyncio.get_event_loop() loop.run_until_complete(do_find_one())
查找一条记录 查找多条记录查找记录可以添加筛选条件。
async def do_find(): cursor = db.test_collection.find({'name': {'$lt': 5}}).sort('i') for document in await cursor.to_List(length=100): pprint.pprint(document) loop = asyncio.get_event_loop() loop.run_until_complete(do_find()) # 添加筛选条件,排序、跳过、限制返回结果数 async def do_find(): cursor = db.test_collection.find({'name': {'$lt': 4}}) # Modify the query before iterating cursor.sort('name', -1).skip(1).limit(2) async for document in cursor: pprint.pprint(document) loop = asyncio.get_event_loop() loop.run_until_complete(do_find())
查找多条记录 统计async def do_count(): n = await db.test_collection.count_documents({}) print('%s documents in collection' % n) n = await db.test_collection.count_documents({'name': {'$gt': 1000}}) print('%s documents where i > 1000' % n) loop = asyncio.get_event_loop() loop.run_until_complete(do_count())
统计 替换替换则是将除 ID 以外的其他内容全部替换掉。
async def do_replace(): coll = db.test_collection old_document = await coll.find_one({'name': 'zone'}) print('found document: %s' % pprint.pformat(old_document)) _ID = old_document['_ID'] result = await coll.replace_one({'_ID': _ID}, {'sex': 'hanson boy'}) print('replaced %s document' % result.modifIEd_count) new_document = await coll.find_one({'_ID': _ID}) print('document is Now %s' % pprint.pformat(new_document)) loop = asyncio.get_event_loop() loop.run_until_complete(do_replace())
替换 更新更新指定字段,不会影响到其他内容。
async def do_update(): coll = db.test_collection result = await coll.update_one({'name': 0}, {'$set': {'sex': 'girl'}}) print('更新条数: %s ' % result.modifIEd_count) new_document = await coll.find_one({'name': 0}) print('更新结果为: %s' % pprint.pformat(new_document)) loop = asyncio.get_event_loop() loop.run_until_complete(do_update())
更新 删除删除指定记录。
async def do_delete_many(): coll = db.test_collection n = await coll.count_documents({}) print('删除前有 %s 条数据' % n) result = await db.test_collection.delete_many({'name': {'$gte': 10}}) print('删除后 %s ' % (await coll.count_documents({}))) loop = asyncio.get_event_loop() loop.run_until_complete(do_delete_many())
后记后台回复「MongoDB」获取源码。MongoDB 的骚 *** 作就介绍到这里,后面会继续写 MysqL 和 Redis 的骚 *** 作,你也可以留言告诉我你想看的知识点,我会抽时间看看,尽可能写一篇。尽请期待。
总结以上是内存溢出为你收集整理的Python 数据库骚 *** 作 — MongoDB全部内容,希望文章能够帮你解决Python 数据库骚 *** 作 — MongoDB所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)