spanner-graph-notebook 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- assets/authentication.png +0 -0
- assets/full_viz.png +0 -0
- assets/hero.png +0 -0
- assets/hero_with_properties.png +0 -0
- assets/jupyter-spin-up.png +0 -0
- assets/load_ext.png +0 -0
- assets/mock_data_result.png +0 -0
- assets/new_notebook.png +0 -0
- assets/notebook_package_load.png +0 -0
- assets/query_graph.png +0 -0
- assets/sample_jupyter.png +0 -0
- spanner_graph_notebook-1.0.0.dist-info/LICENSE +202 -0
- spanner_graph_notebook-1.0.0.dist-info/METADATA +169 -0
- spanner_graph_notebook-1.0.0.dist-info/RECORD +40 -0
- spanner_graph_notebook-1.0.0.dist-info/WHEEL +5 -0
- spanner_graph_notebook-1.0.0.dist-info/top_level.txt +2 -0
- spanner_graphs/__init__.py +19 -0
- spanner_graphs/conversion.py +299 -0
- spanner_graphs/database.py +199 -0
- spanner_graphs/graph_entities.py +405 -0
- spanner_graphs/graph_mock_data.csv +51 -0
- spanner_graphs/graph_mock_schema.json +681 -0
- spanner_graphs/magics.py +211 -0
- spanner_graphs/schema_manager.py +60 -0
- templates/assets/images/graph-bg.svg +4 -0
- templates/spanner-graph/models/edge.js +77 -0
- templates/spanner-graph/models/graph-object.js +64 -0
- templates/spanner-graph/models/node.js +77 -0
- templates/spanner-graph/models/schema.js +327 -0
- templates/spanner-graph/spanner-config.js +304 -0
- templates/spanner-graph/spanner-store.js +382 -0
- templates/spanner-graph/visualization/spanner-forcegraph.js +1380 -0
- templates/spanner-graph/visualization/spanner-sidebar.js +904 -0
- templates/template-spannergraph.html +210 -0
- tests/__init__.py +13 -0
- tests/conversion_test.py +163 -0
- tests/database_test.py +62 -0
- tests/graph_entities_test.py +124 -0
- tests/schema_manager_test.py +115 -0
- tests/test_notebook.json +23 -0
|
Binary file
|
assets/full_viz.png
ADDED
|
Binary file
|
assets/hero.png
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
assets/load_ext.png
ADDED
|
Binary file
|
|
Binary file
|
assets/new_notebook.png
ADDED
|
Binary file
|
|
Binary file
|
assets/query_graph.png
ADDED
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: spanner-graph-notebook
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Visually query Spanner Graph data in notebooks.
|
|
5
|
+
Description-Content-Type: text/markdown
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Requires-Dist: networkx
|
|
8
|
+
Requires-Dist: numpy
|
|
9
|
+
Requires-Dist: google-cloud-spanner
|
|
10
|
+
Requires-Dist: ipython
|
|
11
|
+
Requires-Dist: ipywidgets
|
|
12
|
+
Requires-Dist: notebook
|
|
13
|
+
|
|
14
|
+
# Spanner Graph Notebook: Explore Your Data Visually
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
The Spanner Graph Notebook tool provides an efficient way for you to query [Spanner Graph](https://cloud.google.com/spanner/docs/graph/overview) visually in a notebook environment (e.g. [Jupyter Notebook](https://jupyter.org/) and [Google Colab](https://colab.google/)). Using [GQL](https://cloud.google.com/spanner/docs/reference/standard-sql/graph-intro) query syntax, you can can extract graph insights and relationship patterns, including node and edge properties, neighbor analysis, schema metadata, and diverse layout topologies.
|
|
18
|
+
|
|
19
|
+
<img src="./assets/full_viz.png" width="800"/>
|
|
20
|
+
|
|
21
|
+
## Install dependencies
|
|
22
|
+
|
|
23
|
+
All dependencies below must be installed before using the tool.
|
|
24
|
+
|
|
25
|
+
### Install the `gcloud` CLI
|
|
26
|
+
|
|
27
|
+
`gcloud` CLI is needed for authentication. Follow the installation [manual](https://cloud.google.com/sdk/docs/install) to install.
|
|
28
|
+
|
|
29
|
+
### Install dependencies
|
|
30
|
+
|
|
31
|
+
Download this package and install its dependencies. Python dependencies should ideally be installed in a managed Python environment using tools like `conda` or `virtualenv`.
|
|
32
|
+
|
|
33
|
+
When in the root directory of the package, follow the command below to create a managed Python environment (example based on `virtualenv`) and install dependencies.
|
|
34
|
+
|
|
35
|
+
```shell
|
|
36
|
+
# Create the virtualenv `viz`.
|
|
37
|
+
python3 -m venv viz
|
|
38
|
+
|
|
39
|
+
# Activate the virtualenv.
|
|
40
|
+
source viz/bin/activate
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
```shell
|
|
44
|
+
# Install dependencies.
|
|
45
|
+
pip install .
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Using
|
|
49
|
+
|
|
50
|
+
### Launch notebook and follow steps in `sample.ipynb`
|
|
51
|
+
|
|
52
|
+
When in the root directory of the package, run `jupyter notebook` to launch Jupyter Notebook.
|
|
53
|
+
|
|
54
|
+
```shell
|
|
55
|
+
jupyter notebook
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
As Jupyter local server runs, it will open up a web portal. You can open open the `sample.ipynb` to step through an example.
|
|
59
|
+
|
|
60
|
+
<img src="./assets/sample_jupyter.png" width="600"/>
|
|
61
|
+
|
|
62
|
+
You must run `%load_ext spanner_graphs` to load this package. `sample.ipynb` contains this cell already.
|
|
63
|
+
|
|
64
|
+
<img src="./assets/load_ext.png" width="600"/>
|
|
65
|
+
|
|
66
|
+
### `%%spanner_graph` magic command
|
|
67
|
+
|
|
68
|
+
This package provides a `%%spanner_graph` magic command, which visualizes graph data in the notebook output cell.
|
|
69
|
+
|
|
70
|
+
### Query and visualize a local dataset with `--mock` flag
|
|
71
|
+
|
|
72
|
+
Using the `--mock` flag for `%%spanner_graph`, you can visualize local graph datasets without connecting to a live Cloud Spanner database. The mock
|
|
73
|
+
dataset renders a network of `person` and `account` nodes, along with edges in between. There is an inserted cell in `sample.ipynb` for the code below.
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
%%spanner_graph --mock
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
<img src="./assets/mock_data_result.png" width="600"/>
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
### Visualize graph queries from your Spanner Graph database
|
|
84
|
+
|
|
85
|
+
#### Authentication
|
|
86
|
+
|
|
87
|
+
To connect to your Spanner database, you need to first authenticate via `gcloud auth`. `gcloud` CLI is needed to use the tool. Follow the installation [manual](https://cloud.google.com/sdk/docs/install) to install.
|
|
88
|
+
|
|
89
|
+
`sample.ipynb` has inserted a code cell for authentication below. Running this opens a new browser tab for the Google Cloud authentication process.
|
|
90
|
+
|
|
91
|
+
```shell
|
|
92
|
+
!gcloud auth application-default login
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
#### Query and visualize Spanner Graph data
|
|
96
|
+
|
|
97
|
+
Using the `%%spanner_graph` magic command, you can visualize graph query results from your Spanner database.
|
|
98
|
+
|
|
99
|
+
The magic command needs to be used with your GCP resource info and a query string:
|
|
100
|
+
- a GCP project id for `--project` option
|
|
101
|
+
- a Spanner instance id for `--instance` option
|
|
102
|
+
- a Spanner Graph database id for `--database` option
|
|
103
|
+
- a [GQL](https://cloud.google.com/spanner/docs/graph/queries-overview) query string
|
|
104
|
+
|
|
105
|
+
<img src="./assets/hero_with_properties.png" width="800">
|
|
106
|
+
|
|
107
|
+
## Query Requirements
|
|
108
|
+
|
|
109
|
+
### Use `TO_JSON` function to return graph elements
|
|
110
|
+
|
|
111
|
+
Graph queries **must use** `TO_JSON` function in the `RETURN` statement to visualize paths, nodes and edges. We recommend visualizing **paths** for data completeness and ease of use.
|
|
112
|
+
|
|
113
|
+
```sql
|
|
114
|
+
👍 Good example returning a path as JSON.
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
GRAPH FinGraph
|
|
118
|
+
MATCH query_path = (person:Person {id: 5})-[owns:Owns]->(accnt:Account)
|
|
119
|
+
RETURN TO_JSON(query_path) AS path_json
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
```sql
|
|
123
|
+
👍 Good example returning a path as JSON in a multiple-hop query.
|
|
124
|
+
|
|
125
|
+
GRAPH FinGraph
|
|
126
|
+
MATCH query_path = (src:Account {id: 9})-[edge]->{1,3}(dst:Account)
|
|
127
|
+
RETURN TO_JSON(query_path) as path_json
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
```sql
|
|
131
|
+
👍 Good example returning multiple paths as JSON.
|
|
132
|
+
|
|
133
|
+
GRAPH FinGraph
|
|
134
|
+
MATCH path_1 = (person:Person {id: 5})-[:Owns]->(accnt:Account),
|
|
135
|
+
path_2 = (src:Account {id: 9})-[:Transfers]->(dst:Account)
|
|
136
|
+
RETURN TO_JSON(path_1) as path_1,
|
|
137
|
+
TO_JSON(path_2) as path_2
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
👎 Anti-example returning nodes properties rather than JSON format graph elements.
|
|
142
|
+
Scalar results other than JSON format graph elements cannot be visualized.
|
|
143
|
+
|
|
144
|
+
GRAPH FinGraph
|
|
145
|
+
MATCH (person:Person {id: 5})-[owns:Owns]->(accnt:Account)
|
|
146
|
+
RETURN person.id AS person,
|
|
147
|
+
owns.amount AS owns,
|
|
148
|
+
accnt.id AS accnt;
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
```sql
|
|
152
|
+
👎 Anti-example returning each node and edges in JSON format verbosely. This will
|
|
153
|
+
work but not as easy as returning a path directly.
|
|
154
|
+
|
|
155
|
+
GRAPH FinGraph
|
|
156
|
+
MATCH (person:Person {id: 5})-[owns:Owns]->(accnt:Account)
|
|
157
|
+
RETURN TO_JSON(person) AS person_json,
|
|
158
|
+
TO_JSON(owns) AS owns_json,
|
|
159
|
+
TO_JSON(accnt) AS accnt_json,
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Testing changes
|
|
163
|
+
|
|
164
|
+
After adding new changes, please run unit and integration tests with the command below:
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
```shell
|
|
168
|
+
cd spanner_graphs && python -m unittest discover -s tests -p "*_test.py"
|
|
169
|
+
```
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
assets/authentication.png,sha256=9-1RHiXLunCSZvKWHYG8KfxVjBRgc5AxNiPl38BiC3s,409313
|
|
2
|
+
assets/full_viz.png,sha256=mSriNkrX_FxTmkfgjOOnjcNdT79SYHbPaPXfC06CAg8,566466
|
|
3
|
+
assets/hero.png,sha256=KUvwRuXhrEfrnHesSZs7ibUsKeoPeMp-kr0GgaPzJnA,543396
|
|
4
|
+
assets/hero_with_properties.png,sha256=HDqSv_ivVMWS8Dnr0dIkQYY7Dyioavu0xzEh1BQqDQo,166527
|
|
5
|
+
assets/jupyter-spin-up.png,sha256=PUhR_dWGfu3KQqzQ9hjoLFmwzu_cEeTya6nCxaei-14,211856
|
|
6
|
+
assets/load_ext.png,sha256=WkpGp8pNU8VI_X0OZjKqXA_a8Vr1SBnIipB2NvfWP3g,38740
|
|
7
|
+
assets/mock_data_result.png,sha256=ufMdcaIaRbLNEjRkkoO2pUOd659m3nkwWeYoJqskY5c,73091
|
|
8
|
+
assets/new_notebook.png,sha256=dX4gsMff27lY-hytCrwNn3YgJPCHXaptl-OYuyCUhZY,96302
|
|
9
|
+
assets/notebook_package_load.png,sha256=XMEyLOwjNVDUV-JHhYbvCAv5E_S_BBXE_LBiMJZLIao,96354
|
|
10
|
+
assets/query_graph.png,sha256=R8IikCQUCqV_iuowPiM5vvyh1IXe4Nf6SLLPcKjKMck,180573
|
|
11
|
+
assets/sample_jupyter.png,sha256=rhrX3Il-eMl_PPSc7ja3-4tQ4dA9N8OKnSWTgCXwhLg,55856
|
|
12
|
+
spanner_graphs/__init__.py,sha256=KRmNltOvEHTDo-Z2Acm_CEc9YDudhoFlTHOm-krKVCQ,678
|
|
13
|
+
spanner_graphs/conversion.py,sha256=7_9oeTeQp2c2ANwtAChtJGPAzH6uTiDM6yhFdtHYyCc,10472
|
|
14
|
+
spanner_graphs/database.py,sha256=R4OpXd1HPy6QGZ5fEYtgCQj8VluoKhIRC_iTsAjqr9k,6957
|
|
15
|
+
spanner_graphs/graph_entities.py,sha256=g8ez1o7rUAGrKTINjuvgEEz_HNG4calHKjkEqYC9C-k,14642
|
|
16
|
+
spanner_graphs/graph_mock_data.csv,sha256=ZVOofd_4UxfV6AKs7GN7FnSLorb79934fSJRbQSgDkU,113970
|
|
17
|
+
spanner_graphs/graph_mock_schema.json,sha256=N4-4QH0bFCu81EXdd0rYO-fvFwZTXV4LWGbmUsDrE9Q,19378
|
|
18
|
+
spanner_graphs/magics.py,sha256=xZi2TJQdfc4pSME0uWVXW8elSguDvYINmQNaxxMppf0,8107
|
|
19
|
+
spanner_graphs/schema_manager.py,sha256=hbOFszi3ONVc5AbGkg6bQQEp0GY0RcQ2djb1soKlXS4,2559
|
|
20
|
+
templates/template-spannergraph.html,sha256=thbdvg_jwDWbFTvnswB1HHgmAZb_65BDwV75kAQ8ODc,6731
|
|
21
|
+
templates/assets/images/graph-bg.svg,sha256=sUkbuF5PbnXzDowV84zR96Nw2teX4ebmEKETlRIaBpI,205
|
|
22
|
+
templates/spanner-graph/spanner-config.js,sha256=PIoZxBUlCzkQpDgdUyNc6yqmhtoceMfzrHFYAhcVAZw,9575
|
|
23
|
+
templates/spanner-graph/spanner-store.js,sha256=oqtjjazBX20zVouWWFjdir40oncIhsW0vFY86arm-J0,12311
|
|
24
|
+
templates/spanner-graph/models/edge.js,sha256=i50EV8yEGKPMbujcifJP3mQXcSBgjrgoMZ8pP2yEXRA,2379
|
|
25
|
+
templates/spanner-graph/models/graph-object.js,sha256=N40PNQkSue1inHolDTZCPZxqAZDWOiHZIKdN9zT4huQ,1821
|
|
26
|
+
templates/spanner-graph/models/node.js,sha256=KwaBvOJLI_AdKYfXiAhZ7Doad3Bge6HFSVz6tG4Bm-U,2303
|
|
27
|
+
templates/spanner-graph/models/schema.js,sha256=1jan2YXNuvQJDvOzrgTJvK-Bw1eiIjNeCr3K4vg2p_w,8802
|
|
28
|
+
templates/spanner-graph/visualization/spanner-forcegraph.js,sha256=4iCroS2eSRaXBnJ6RCzxT7AWXPdIXHS2y19iiXTDEiA,57947
|
|
29
|
+
templates/spanner-graph/visualization/spanner-sidebar.js,sha256=voGVJjyiOPFIEc8ibzyXYh6s53sxBGEUcxHkJKkGrQU,29290
|
|
30
|
+
tests/__init__.py,sha256=3sZgHNkTCaRvCtTxaJbjMiny_qQErVLaVQAniFGYM1g,572
|
|
31
|
+
tests/conversion_test.py,sha256=OvbAuXt0ZmtJ-sUm41i_3-5BVaFCXDSL4iFigTGFYHA,6504
|
|
32
|
+
tests/database_test.py,sha256=kBouAaxqvH8xiiXoVt5JJvRm1kCyGbHLsoq711DKZNo,2279
|
|
33
|
+
tests/graph_entities_test.py,sha256=5aXOyW_SHcELhYf60IbjZv4-Dl8gz7E0fBjDJmRm15E,3898
|
|
34
|
+
tests/schema_manager_test.py,sha256=TLMSq-D7KGnlY3uSbskIwKHToMY5-iwkIWu6px_RDwU,3933
|
|
35
|
+
tests/test_notebook.json,sha256=qCBbyV_FJq3YeGD-UnbB8YcrDRhYTbJiM4gLe-1ykFg,598
|
|
36
|
+
spanner_graph_notebook-1.0.0.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
|
|
37
|
+
spanner_graph_notebook-1.0.0.dist-info/METADATA,sha256=rOjyxnADFSvYZ7-O5ER9kWIsp_gs-9_fN6Y6n6Pui38,5716
|
|
38
|
+
spanner_graph_notebook-1.0.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
|
39
|
+
spanner_graph_notebook-1.0.0.dist-info/top_level.txt,sha256=SJfDfCtv4ANsHf2_3yh7Psmuvew_xN273AsR0M6XjEE,21
|
|
40
|
+
spanner_graph_notebook-1.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Copyright 2024 Google LLC
|
|
2
|
+
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
"""Exported modules"""
|
|
16
|
+
|
|
17
|
+
from .magics import load_ipython_extension
|
|
18
|
+
|
|
19
|
+
__all__ = ["load_ipython_extension"]
|