FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
datajoint-python/tests/schema_uuid.py at master · mohammadbashiri/datajoint-python · GitHub
mohammadbashiri
datajoint-python
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
datajoint-python
/
tests
/
schema_uuid.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
46 lines (35 loc) · 1.13 KB
Breadcrumbs
datajoint-python
/
tests
/
schema_uuid.py
Copy path
File metadata and controls
46 lines (35 loc) · 1.13 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import
uuid
import
datajoint
as
dj
from
.
import
PREFIX
,
CONN_INFO
schema
=
dj
.
Schema
(
PREFIX
+
'_test1'
,
connection
=
dj
.
conn
(
**
CONN_INFO
))
top_level_namespace_id
=
uuid
.
UUID
(
'00000000-0000-0000-0000-000000000000'
)
@
schema
class
Basic
(
dj
.
Manual
):
definition
=
"""
item : uuid
---
number : int
"""
@
schema
class
Topic
(
dj
.
Manual
):
definition
=
"""
# A topic for items
topic_id : uuid # internal identification of a topic, reflects topic name
---
topic : varchar(8000) # full topic name used to generate the topic id
"""
def
add
(
self
,
topic
):
"""add a new topic with a its UUID"""
self
.
insert1
(
dict
(
topic_id
=
uuid
.
uuid5
(
top_level_namespace_id
,
topic
),
topic
=
topic
))
@
schema
class
Item
(
dj
.
Computed
):
definition
=
"""
item_id : uuid # internal identification of
---
-> Topic
word : varchar(8000)
"""
key_source
=
Topic
# test key source that is not instantiated
def
make
(
self
,
key
):
for
word
in
(
'Habenula'
,
'Hippocampus'
,
'Hypothalamus'
,
'Hypophysis'
):
self
.
insert1
(
dict
(
key
,
word
=
word
,
item_id
=
uuid
.
uuid5
(
key
[
'topic_id'
],
word
)))
Back
|
FazBrowse Home
|
New Git URL