Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
DA-Platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
文档服务地址:
http://47.92.0.57:3000/
周报索引地址:
http://47.92.0.57:3000/s/NruNXRYmV
Open sidebar
Berlin
DA-Platform
Commits
1591e93f
Commit
1591e93f
authored
Aug 10, 2020
by
李景熙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加“数据单”表
parent
3ebad4b7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
0 deletions
+43
-0
data_set.py
DAPlatform/Dao/data_set.py
+43
-0
No files found.
DAPlatform/Dao/data_set.py
0 → 100644
View file @
1591e93f
from
pymongo
import
MongoClient
host
=
'47.92.1.107'
# 服务器url
client
=
MongoClient
(
host
,
8081
)
# 服务器端口
db
=
client
.
da
# 数据库=test
db
.
authenticate
(
"admin"
,
"admin"
)
# 账号密码
collection_data_set
=
db
.
dataset
# 添加用户的数据单
def
insert_data_set
(
data_set
):
try
:
re
=
collection_data_set
.
insert_one
(
data_set
)
return
re
except
Exception
as
e
:
print
(
e
)
return
None
# 查找某用户对应的数据单列表
def
find_data_set
(
user_id
):
try
:
results
=
collection_data_set
.
find
({
'user_id'
:
user_id
})
dictionary
=
[]
for
i
in
results
:
i
.
pop
(
"_id"
)
dictionary
.
append
(
i
)
return
dictionary
except
Exception
as
e
:
print
(
e
)
return
None
# 删除某数据单列表
def
delete_data_set
(
_id
):
try
:
result
=
collection_data_set
.
find_one
({
'data_set_id'
:
_id
})
collection_data_set
.
delete_one
({
'data_set_id'
:
_id
})
return
result
except
Exception
as
e
:
print
(
e
)
return
None
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment