polypheny-prism-api 2.0__tar.gz → 2.2__tar.gz

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.
Files changed (33) hide show
  1. polypheny_prism_api-2.2/PKG-INFO +66 -0
  2. {polypheny-prism-api-2.0 → polypheny_prism_api-2.2}/README.md +10 -0
  3. {polypheny-prism-api-2.0 → polypheny_prism_api-2.2}/org/polypheny/prism/namespace_meta_responses_pb2.py +7 -3
  4. {polypheny-prism-api-2.0 → polypheny_prism_api-2.2}/org/polypheny/prism/version.py +1 -1
  5. polypheny_prism_api-2.2/polypheny_prism_api.egg-info/PKG-INFO +66 -0
  6. {polypheny-prism-api-2.0 → polypheny_prism_api-2.2}/polypheny_prism_api.egg-info/SOURCES.txt +2 -1
  7. polypheny_prism_api-2.2/prism-api-version.txt +1 -0
  8. polypheny_prism_api-2.2/tests/test_document_metadata.py +158 -0
  9. polypheny-prism-api-2.0/PKG-INFO +0 -45
  10. polypheny-prism-api-2.0/polypheny_prism_api.egg-info/PKG-INFO +0 -45
  11. polypheny-prism-api-2.0/prism-api-version.txt +0 -1
  12. {polypheny-prism-api-2.0 → polypheny_prism_api-2.2}/LICENSE +0 -0
  13. {polypheny-prism-api-2.0 → polypheny_prism_api-2.2}/MANIFEST.in +0 -0
  14. {polypheny-prism-api-2.0 → polypheny_prism_api-2.2}/org/polypheny/prism/connection_requests_pb2.py +0 -0
  15. {polypheny-prism-api-2.0 → polypheny_prism_api-2.2}/org/polypheny/prism/connection_responses_pb2.py +0 -0
  16. {polypheny-prism-api-2.0 → polypheny_prism_api-2.2}/org/polypheny/prism/document_frame_pb2.py +0 -0
  17. {polypheny-prism-api-2.0 → polypheny_prism_api-2.2}/org/polypheny/prism/error_pb2.py +0 -0
  18. {polypheny-prism-api-2.0 → polypheny_prism_api-2.2}/org/polypheny/prism/graph_frame_pb2.py +0 -0
  19. {polypheny-prism-api-2.0 → polypheny_prism_api-2.2}/org/polypheny/prism/meta_requests_pb2.py +0 -0
  20. {polypheny-prism-api-2.0 → polypheny_prism_api-2.2}/org/polypheny/prism/meta_responses_pb2.py +0 -0
  21. {polypheny-prism-api-2.0 → polypheny_prism_api-2.2}/org/polypheny/prism/namespace_meta_requests_pb2.py +0 -0
  22. {polypheny-prism-api-2.0 → polypheny_prism_api-2.2}/org/polypheny/prism/protointerface_pb2.py +0 -0
  23. {polypheny-prism-api-2.0 → polypheny_prism_api-2.2}/org/polypheny/prism/relational_frame_pb2.py +0 -0
  24. {polypheny-prism-api-2.0 → polypheny_prism_api-2.2}/org/polypheny/prism/statement_requests_pb2.py +0 -0
  25. {polypheny-prism-api-2.0 → polypheny_prism_api-2.2}/org/polypheny/prism/statement_responses_pb2.py +0 -0
  26. {polypheny-prism-api-2.0 → polypheny_prism_api-2.2}/org/polypheny/prism/transaction_requests_pb2.py +0 -0
  27. {polypheny-prism-api-2.0 → polypheny_prism_api-2.2}/org/polypheny/prism/transaction_responses_pb2.py +0 -0
  28. {polypheny-prism-api-2.0 → polypheny_prism_api-2.2}/org/polypheny/prism/value_pb2.py +0 -0
  29. {polypheny-prism-api-2.0 → polypheny_prism_api-2.2}/polypheny_prism_api.egg-info/dependency_links.txt +0 -0
  30. {polypheny-prism-api-2.0 → polypheny_prism_api-2.2}/polypheny_prism_api.egg-info/requires.txt +0 -0
  31. {polypheny-prism-api-2.0 → polypheny_prism_api-2.2}/polypheny_prism_api.egg-info/top_level.txt +0 -0
  32. {polypheny-prism-api-2.0 → polypheny_prism_api-2.2}/setup.cfg +0 -0
  33. {polypheny-prism-api-2.0 → polypheny_prism_api-2.2}/setup.py +0 -0
@@ -0,0 +1,66 @@
1
+ Metadata-Version: 2.4
2
+ Name: polypheny-prism-api
3
+ Version: 2.2
4
+ Summary: Polypheny Prism API files for Python
5
+ Home-page: https://polypheny.com/
6
+ Author: The Polypheny Project
7
+ Author-email: mail@polypheny.org
8
+ License: Apache License, Version 2.0
9
+ Project-URL: Documentation, https://docs.polypheny.com/en/latest/query_interfaces/prism/protocol
10
+ Project-URL: Code, https://github.com/polypheny/Polypheny-Prism-API
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: protobuf==5.27.2
14
+ Dynamic: author
15
+ Dynamic: author-email
16
+ Dynamic: description
17
+ Dynamic: description-content-type
18
+ Dynamic: home-page
19
+ Dynamic: license
20
+ Dynamic: license-file
21
+ Dynamic: project-url
22
+ Dynamic: requires-dist
23
+ Dynamic: summary
24
+
25
+ # Polypheny-Prism-API
26
+ The definition files for the Polypheny Prism API, a multi-model, multi-language query interface.
27
+
28
+ The Prism Interface uses Protocol Buffer (protobuf) messages to define it's services. To keep things clear and well-organized, the message definitions are grouped into several files. This simplifies finding specific messages, based on what they do or what part of the system they relate to. The files itself are grouped in categories. Those are expressed in the file names.
29
+ Two kinds of categories exist:
30
+
31
+ ### Request Response Category
32
+
33
+ The category type contains messages that are used in communication adhering to a request, response scheme. Here the client sends a request message to the server upon which the server sends back a response message.
34
+
35
+ - **Requests File**: This file contains all messages that are sent from the client to the server. The file name adheres to the following pattern: `[category]_requests.proto`. For example, all the request messages for making or managing connections would be in `connection_requests.proto`.
36
+
37
+ - **Responses File**: This is the partner file to Requests. It contains all the messages the server sends back to the client. Following the naming pattern, these files end with `_responses.proto`. The response messages related to connections would thus be in `connection_responses.proto`.
38
+
39
+ ### Other Category
40
+ The other kind of category contains messages that are not directly used as a response to a request. An example therefore would be messages representing a specific datatype supported by the DBMS.
41
+ This category always contains only one file. The filename adheres to the pattern `[category].proto`.
42
+
43
+ ### Doc Generator
44
+ Detailed Documentation of the proto files their messages and enums and much more can automatically be created using the doc generator included in this repo.
45
+ For this to work, the protobuf compiler must be installed. It's current version can be downloaded [here](https://github.com/protocolbuffers/protobuf/releases/).
46
+
47
+ To run the doc generator, execute the file `generator.py` in the `doc-generator` directory.
48
+
49
+ This creates a directory called docs containing the generated documentation.
50
+
51
+ ### Generate Python files
52
+
53
+ Generate the Python code:
54
+ ```
55
+ python -m grpc_tools.protoc -I . --python_out . org/polypheny/prism/*.proto
56
+ ```
57
+
58
+ ### Test protocol contracts
59
+
60
+ The Python contract tests compile the checked-out definitions into a temporary directory
61
+ and check the document metadata messages, wire compatibility, and optional-field presence.
62
+
63
+ ```
64
+ python -m pip install -r requirements.txt
65
+ python -m unittest discover -s tests -v
66
+ ```
@@ -30,3 +30,13 @@ Generate the Python code:
30
30
  ```
31
31
  python -m grpc_tools.protoc -I . --python_out . org/polypheny/prism/*.proto
32
32
  ```
33
+
34
+ ### Test protocol contracts
35
+
36
+ The Python contract tests compile the checked-out definitions into a temporary directory
37
+ and check the document metadata messages, wire compatibility, and optional-field presence.
38
+
39
+ ```
40
+ python -m pip install -r requirements.txt
41
+ python -m unittest discover -s tests -v
42
+ ```
@@ -14,7 +14,7 @@ _sym_db = _symbol_database.Default()
14
14
 
15
15
 
16
16
 
17
- DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n2org/polypheny/prism/namespace_meta_responses.proto\x12\x13org.polypheny.prism\"H\n\x12NamespacesResponse\x12\x32\n\nnamespaces\x18\x01 \x03(\x0b\x32\x1e.org.polypheny.prism.Namespace\"A\n\x10\x45ntitiesResponse\x12-\n\x08\x65ntities\x18\x01 \x03(\x0b\x32\x1b.org.polypheny.prism.Entity\"n\n\tNamespace\x12\x16\n\x0enamespace_name\x18\x01 \x01(\t\x12\x19\n\x11is_case_sensitive\x18\x04 \x01(\x08\x12\x1b\n\x0enamespace_type\x18\x05 \x01(\tH\x00\x88\x01\x01\x42\x11\n\x0f_namespace_type\"\x9f\x01\n\x06\x45ntity\x12+\n\x05table\x18\x01 \x01(\x0b\x32\x1a.org.polypheny.prism.TableH\x00\x12+\n\x05graph\x18\x02 \x01(\x0b\x32\x1a.org.polypheny.prism.GraphH\x00\x12\x31\n\x08\x64ocument\x18\x03 \x01(\x0b\x32\x1d.org.polypheny.prism.DocumentH\x00\x42\x08\n\x06\x45ntity\"\xdc\x02\n\x05Table\x12\x16\n\x0enamespace_name\x18\x02 \x01(\t\x12\x12\n\ntable_name\x18\x03 \x01(\t\x12\x12\n\ntable_type\x18\x04 \x01(\t\x12,\n\x07\x63olumns\x18\x06 \x03(\x0b\x32\x1b.org.polypheny.prism.Column\x12\x39\n\x0bprimary_key\x18\x07 \x01(\x0b\x32\x1f.org.polypheny.prism.PrimaryKeyH\x00\x88\x01\x01\x12\x35\n\x0c\x66oreign_keys\x18\x08 \x03(\x0b\x32\x1f.org.polypheny.prism.ForeignKey\x12\x36\n\rexported_keys\x18\t \x03(\x0b\x32\x1f.org.polypheny.prism.ForeignKey\x12+\n\x07indexes\x18\n \x03(\x0b\x32\x1a.org.polypheny.prism.IndexB\x0e\n\x0c_primary_key\"\xda\x03\n\x06\x43olumn\x12\x16\n\x0enamespace_name\x18\x02 \x01(\t\x12\x12\n\ntable_name\x18\x03 \x01(\t\x12\x13\n\x0b\x63olumn_name\x18\x04 \x01(\t\x12\x11\n\ttype_name\x18\x05 \x01(\t\x12\x18\n\x0btype_length\x18\x06 \x01(\x05H\x00\x88\x01\x01\x12\x17\n\ntype_scale\x18\x07 \x01(\x05H\x01\x88\x01\x01\x12\x13\n\x0bis_nullable\x18\x08 \x01(\x08\x12$\n\x17\x64\x65\x66\x61ult_value_as_string\x18\t \x01(\tH\x02\x88\x01\x01\x12\x14\n\x0c\x63olumn_index\x18\n \x01(\x05\x12\x16\n\tcollation\x18\x0b \x01(\tH\x03\x88\x01\x01\x12\x11\n\tis_hidden\x18\x0c \x01(\x08\x12;\n\x0b\x63olumn_type\x18\r \x01(\x0e\x32&.org.polypheny.prism.Column.ColumnType\"G\n\nColumnType\x12\x0f\n\x0bUNSPECIFIED\x10\x00\x12\x0b\n\x07REGULAR\x10\x01\x12\x0e\n\nCALCULATED\x10\x02\x12\x0b\n\x07VERSION\x10\x03\x42\x0e\n\x0c_type_lengthB\r\n\x0b_type_scaleB\x1a\n\x18_default_value_as_stringB\x0c\n\n_collation\"}\n\nPrimaryKey\x12\x15\n\rdatabase_name\x18\x01 \x01(\t\x12\x16\n\x0enamespace_name\x18\x02 \x01(\t\x12\x12\n\ntable_name\x18\x03 \x01(\t\x12,\n\x07\x63olumns\x18\x04 \x03(\x0b\x32\x1b.org.polypheny.prism.Column\"\xae\x02\n\nForeignKey\x12&\n\x19referenced_namespace_name\x18\x02 \x01(\tH\x00\x88\x01\x01\x12\x1d\n\x15referenced_table_name\x18\x03 \x01(\t\x12\x37\n\x12referenced_columns\x18\x04 \x03(\x0b\x32\x1b.org.polypheny.prism.Column\x12\x34\n\x0f\x66oreign_columns\x18\x08 \x03(\x0b\x32\x1b.org.polypheny.prism.Column\x12\x13\n\x0bupdate_rule\x18\n \x01(\x05\x12\x13\n\x0b\x64\x65lete_rule\x18\x0b \x01(\x05\x12\x15\n\x08key_name\x18\x0c \x01(\tH\x01\x88\x01\x01\x42\x1c\n\x1a_referenced_namespace_nameB\x0b\n\t_key_name\"\xab\x01\n\x05Index\x12\x16\n\x0enamespace_name\x18\x02 \x01(\t\x12\x12\n\ntable_name\x18\x03 \x01(\t\x12\x0e\n\x06unique\x18\x04 \x01(\x08\x12\x12\n\nindex_name\x18\x05 \x01(\t\x12,\n\x07\x63olumns\x18\x06 \x03(\x0b\x32\x1b.org.polypheny.prism.Column\x12\x10\n\x08location\x18\x08 \x01(\x03\x12\x12\n\nindex_type\x18\t \x01(\x05\"\x07\n\x05Graph\"\n\n\x08\x44ocumentB\\\n\x13org.polypheny.prismB\x16NamespaceMetaResponsesP\x01Z\x19org/polypheny/prism;prism\xaa\x02\x0fPolypheny.Prismb\x06proto3')
17
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n2org/polypheny/prism/namespace_meta_responses.proto\x12\x13org.polypheny.prism\"H\n\x12NamespacesResponse\x12\x32\n\nnamespaces\x18\x01 \x03(\x0b\x32\x1e.org.polypheny.prism.Namespace\"A\n\x10\x45ntitiesResponse\x12-\n\x08\x65ntities\x18\x01 \x03(\x0b\x32\x1b.org.polypheny.prism.Entity\"n\n\tNamespace\x12\x16\n\x0enamespace_name\x18\x01 \x01(\t\x12\x19\n\x11is_case_sensitive\x18\x04 \x01(\x08\x12\x1b\n\x0enamespace_type\x18\x05 \x01(\tH\x00\x88\x01\x01\x42\x11\n\x0f_namespace_type\"\x9f\x01\n\x06\x45ntity\x12+\n\x05table\x18\x01 \x01(\x0b\x32\x1a.org.polypheny.prism.TableH\x00\x12+\n\x05graph\x18\x02 \x01(\x0b\x32\x1a.org.polypheny.prism.GraphH\x00\x12\x31\n\x08\x64ocument\x18\x03 \x01(\x0b\x32\x1d.org.polypheny.prism.DocumentH\x00\x42\x08\n\x06\x45ntity\"\xdc\x02\n\x05Table\x12\x16\n\x0enamespace_name\x18\x02 \x01(\t\x12\x12\n\ntable_name\x18\x03 \x01(\t\x12\x12\n\ntable_type\x18\x04 \x01(\t\x12,\n\x07\x63olumns\x18\x06 \x03(\x0b\x32\x1b.org.polypheny.prism.Column\x12\x39\n\x0bprimary_key\x18\x07 \x01(\x0b\x32\x1f.org.polypheny.prism.PrimaryKeyH\x00\x88\x01\x01\x12\x35\n\x0c\x66oreign_keys\x18\x08 \x03(\x0b\x32\x1f.org.polypheny.prism.ForeignKey\x12\x36\n\rexported_keys\x18\t \x03(\x0b\x32\x1f.org.polypheny.prism.ForeignKey\x12+\n\x07indexes\x18\n \x03(\x0b\x32\x1a.org.polypheny.prism.IndexB\x0e\n\x0c_primary_key\"\xda\x03\n\x06\x43olumn\x12\x16\n\x0enamespace_name\x18\x02 \x01(\t\x12\x12\n\ntable_name\x18\x03 \x01(\t\x12\x13\n\x0b\x63olumn_name\x18\x04 \x01(\t\x12\x11\n\ttype_name\x18\x05 \x01(\t\x12\x18\n\x0btype_length\x18\x06 \x01(\x05H\x00\x88\x01\x01\x12\x17\n\ntype_scale\x18\x07 \x01(\x05H\x01\x88\x01\x01\x12\x13\n\x0bis_nullable\x18\x08 \x01(\x08\x12$\n\x17\x64\x65\x66\x61ult_value_as_string\x18\t \x01(\tH\x02\x88\x01\x01\x12\x14\n\x0c\x63olumn_index\x18\n \x01(\x05\x12\x16\n\tcollation\x18\x0b \x01(\tH\x03\x88\x01\x01\x12\x11\n\tis_hidden\x18\x0c \x01(\x08\x12;\n\x0b\x63olumn_type\x18\r \x01(\x0e\x32&.org.polypheny.prism.Column.ColumnType\"G\n\nColumnType\x12\x0f\n\x0bUNSPECIFIED\x10\x00\x12\x0b\n\x07REGULAR\x10\x01\x12\x0e\n\nCALCULATED\x10\x02\x12\x0b\n\x07VERSION\x10\x03\x42\x0e\n\x0c_type_lengthB\r\n\x0b_type_scaleB\x1a\n\x18_default_value_as_stringB\x0c\n\n_collation\"}\n\nPrimaryKey\x12\x15\n\rdatabase_name\x18\x01 \x01(\t\x12\x16\n\x0enamespace_name\x18\x02 \x01(\t\x12\x12\n\ntable_name\x18\x03 \x01(\t\x12,\n\x07\x63olumns\x18\x04 \x03(\x0b\x32\x1b.org.polypheny.prism.Column\"\xae\x02\n\nForeignKey\x12&\n\x19referenced_namespace_name\x18\x02 \x01(\tH\x00\x88\x01\x01\x12\x1d\n\x15referenced_table_name\x18\x03 \x01(\t\x12\x37\n\x12referenced_columns\x18\x04 \x03(\x0b\x32\x1b.org.polypheny.prism.Column\x12\x34\n\x0f\x66oreign_columns\x18\x08 \x03(\x0b\x32\x1b.org.polypheny.prism.Column\x12\x13\n\x0bupdate_rule\x18\n \x01(\x05\x12\x13\n\x0b\x64\x65lete_rule\x18\x0b \x01(\x05\x12\x15\n\x08key_name\x18\x0c \x01(\tH\x01\x88\x01\x01\x42\x1c\n\x1a_referenced_namespace_nameB\x0b\n\t_key_name\"\xab\x01\n\x05Index\x12\x16\n\x0enamespace_name\x18\x02 \x01(\t\x12\x12\n\ntable_name\x18\x03 \x01(\t\x12\x0e\n\x06unique\x18\x04 \x01(\x08\x12\x12\n\nindex_name\x18\x05 \x01(\t\x12,\n\x07\x63olumns\x18\x06 \x03(\x0b\x32\x1b.org.polypheny.prism.Column\x12\x10\n\x08location\x18\x08 \x01(\x03\x12\x12\n\nindex_type\x18\t \x01(\x05\"\x07\n\x05Graph\"\xe9\x01\n\x08\x44ocument\x12\x16\n\x0enamespace_name\x18\x01 \x01(\t\x12\x17\n\x0f\x63ollection_name\x18\x02 \x01(\t\x12\x32\n\x06\x66ields\x18\x03 \x03(\x0b\x32\".org.polypheny.prism.DocumentField\x12!\n\x14sample_document_json\x18\x04 \x01(\tH\x00\x88\x01\x01\x12<\n\x10\x64ocument_indexes\x18\x05 \x03(\x0b\x32\".org.polypheny.prism.DocumentIndexB\x17\n\x15_sample_document_json\"K\n\rDocumentField\x12\x12\n\nfield_path\x18\x01 \x01(\t\x12\x11\n\ttype_name\x18\x02 \x01(\t\x12\x13\n\x0bis_optional\x18\x03 \x01(\x08\"G\n\rDocumentIndex\x12\x12\n\nfield_path\x18\x01 \x01(\t\x12\x12\n\nindex_type\x18\x02 \x01(\t\x12\x0e\n\x06unique\x18\x03 \x01(\x08\x42\\\n\x13org.polypheny.prismB\x16NamespaceMetaResponsesP\x01Z\x19org/polypheny/prism;prism\xaa\x02\x0fPolypheny.Prismb\x06proto3')
18
18
 
19
19
  _globals = globals()
20
20
  _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
@@ -44,6 +44,10 @@ if not _descriptor._USE_C_DESCRIPTORS:
44
44
  _globals['_INDEX']._serialized_end=1922
45
45
  _globals['_GRAPH']._serialized_start=1924
46
46
  _globals['_GRAPH']._serialized_end=1931
47
- _globals['_DOCUMENT']._serialized_start=1933
48
- _globals['_DOCUMENT']._serialized_end=1943
47
+ _globals['_DOCUMENT']._serialized_start=1934
48
+ _globals['_DOCUMENT']._serialized_end=2167
49
+ _globals['_DOCUMENTFIELD']._serialized_start=2169
50
+ _globals['_DOCUMENTFIELD']._serialized_end=2244
51
+ _globals['_DOCUMENTINDEX']._serialized_start=2246
52
+ _globals['_DOCUMENTINDEX']._serialized_end=2317
49
53
  # @@protoc_insertion_point(module_scope)
@@ -1,2 +1,2 @@
1
1
  MAJOR_VERSION = 2
2
- MINOR_VERSION = 0
2
+ MINOR_VERSION = 2
@@ -0,0 +1,66 @@
1
+ Metadata-Version: 2.4
2
+ Name: polypheny-prism-api
3
+ Version: 2.2
4
+ Summary: Polypheny Prism API files for Python
5
+ Home-page: https://polypheny.com/
6
+ Author: The Polypheny Project
7
+ Author-email: mail@polypheny.org
8
+ License: Apache License, Version 2.0
9
+ Project-URL: Documentation, https://docs.polypheny.com/en/latest/query_interfaces/prism/protocol
10
+ Project-URL: Code, https://github.com/polypheny/Polypheny-Prism-API
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: protobuf==5.27.2
14
+ Dynamic: author
15
+ Dynamic: author-email
16
+ Dynamic: description
17
+ Dynamic: description-content-type
18
+ Dynamic: home-page
19
+ Dynamic: license
20
+ Dynamic: license-file
21
+ Dynamic: project-url
22
+ Dynamic: requires-dist
23
+ Dynamic: summary
24
+
25
+ # Polypheny-Prism-API
26
+ The definition files for the Polypheny Prism API, a multi-model, multi-language query interface.
27
+
28
+ The Prism Interface uses Protocol Buffer (protobuf) messages to define it's services. To keep things clear and well-organized, the message definitions are grouped into several files. This simplifies finding specific messages, based on what they do or what part of the system they relate to. The files itself are grouped in categories. Those are expressed in the file names.
29
+ Two kinds of categories exist:
30
+
31
+ ### Request Response Category
32
+
33
+ The category type contains messages that are used in communication adhering to a request, response scheme. Here the client sends a request message to the server upon which the server sends back a response message.
34
+
35
+ - **Requests File**: This file contains all messages that are sent from the client to the server. The file name adheres to the following pattern: `[category]_requests.proto`. For example, all the request messages for making or managing connections would be in `connection_requests.proto`.
36
+
37
+ - **Responses File**: This is the partner file to Requests. It contains all the messages the server sends back to the client. Following the naming pattern, these files end with `_responses.proto`. The response messages related to connections would thus be in `connection_responses.proto`.
38
+
39
+ ### Other Category
40
+ The other kind of category contains messages that are not directly used as a response to a request. An example therefore would be messages representing a specific datatype supported by the DBMS.
41
+ This category always contains only one file. The filename adheres to the pattern `[category].proto`.
42
+
43
+ ### Doc Generator
44
+ Detailed Documentation of the proto files their messages and enums and much more can automatically be created using the doc generator included in this repo.
45
+ For this to work, the protobuf compiler must be installed. It's current version can be downloaded [here](https://github.com/protocolbuffers/protobuf/releases/).
46
+
47
+ To run the doc generator, execute the file `generator.py` in the `doc-generator` directory.
48
+
49
+ This creates a directory called docs containing the generated documentation.
50
+
51
+ ### Generate Python files
52
+
53
+ Generate the Python code:
54
+ ```
55
+ python -m grpc_tools.protoc -I . --python_out . org/polypheny/prism/*.proto
56
+ ```
57
+
58
+ ### Test protocol contracts
59
+
60
+ The Python contract tests compile the checked-out definitions into a temporary directory
61
+ and check the document metadata messages, wire compatibility, and optional-field presence.
62
+
63
+ ```
64
+ python -m pip install -r requirements.txt
65
+ python -m unittest discover -s tests -v
66
+ ```
@@ -24,4 +24,5 @@ polypheny_prism_api.egg-info/PKG-INFO
24
24
  polypheny_prism_api.egg-info/SOURCES.txt
25
25
  polypheny_prism_api.egg-info/dependency_links.txt
26
26
  polypheny_prism_api.egg-info/requires.txt
27
- polypheny_prism_api.egg-info/top_level.txt
27
+ polypheny_prism_api.egg-info/top_level.txt
28
+ tests/test_document_metadata.py
@@ -0,0 +1 @@
1
+ 2.2
@@ -0,0 +1,158 @@
1
+ """Contract tests generated from the actual Prism protocol definitions.
2
+
3
+ Run with: python -m unittest discover -s tests -v
4
+ """
5
+
6
+ import importlib
7
+ import json
8
+ from pathlib import Path
9
+ import subprocess
10
+ import sys
11
+ import tempfile
12
+ import unittest
13
+
14
+ from google.protobuf import descriptor_pb2, descriptor_pool, message_factory
15
+
16
+
17
+ class DocumentMetadataContractTest(unittest.TestCase):
18
+ @classmethod
19
+ def setUpClass(cls):
20
+ cls.generated = tempfile.TemporaryDirectory()
21
+ cls.addClassCleanup(cls.generated.cleanup)
22
+ root = Path(__file__).resolve().parents[1]
23
+ proto_files = sorted(root.glob("org/polypheny/prism/*.proto"))
24
+ subprocess.run(
25
+ [sys.executable, "-m", "grpc_tools.protoc", f"-I{root}",
26
+ f"--python_out={cls.generated.name}"]
27
+ + [str(path) for path in proto_files],
28
+ check=True,
29
+ )
30
+ sys.path.insert(0, cls.generated.name)
31
+ cls.addClassCleanup(sys.path.remove, cls.generated.name)
32
+ cls.meta = importlib.import_module(
33
+ "org.polypheny.prism.namespace_meta_responses_pb2"
34
+ )
35
+
36
+ def test_field_numbers_types_and_cardinality(self):
37
+ field = descriptor_pb2.FieldDescriptorProto
38
+ expected = {
39
+ "Document": [
40
+ ("namespace_name", 1, field.TYPE_STRING, False),
41
+ ("collection_name", 2, field.TYPE_STRING, False),
42
+ ("fields", 3, field.TYPE_MESSAGE, True),
43
+ ("sample_document_json", 4, field.TYPE_STRING, False),
44
+ ("document_indexes", 5, field.TYPE_MESSAGE, True),
45
+ ],
46
+ "DocumentField": [
47
+ ("field_path", 1, field.TYPE_STRING, False),
48
+ ("type_name", 2, field.TYPE_STRING, False),
49
+ ("is_optional", 3, field.TYPE_BOOL, False),
50
+ ],
51
+ "DocumentIndex": [
52
+ ("field_path", 1, field.TYPE_STRING, False),
53
+ ("index_type", 2, field.TYPE_STRING, False),
54
+ ("unique", 3, field.TYPE_BOOL, False),
55
+ ],
56
+ }
57
+ for name, fields in expected.items():
58
+ with self.subTest(message=name):
59
+ actual = getattr(self.meta, name).DESCRIPTOR.fields
60
+ self.assertEqual(
61
+ [(item.name, item.number, item.type,
62
+ item.label == field.LABEL_REPEATED) for item in actual],
63
+ fields,
64
+ )
65
+ self.assertEqual(
66
+ self.meta.Document.DESCRIPTOR.fields_by_name["fields"].message_type.full_name,
67
+ "org.polypheny.prism.DocumentField",
68
+ )
69
+ self.assertEqual(
70
+ self.meta.Document.DESCRIPTOR.fields_by_name["document_indexes"].message_type.full_name,
71
+ "org.polypheny.prism.DocumentIndex",
72
+ )
73
+
74
+ def test_all_metadata_survives_entities_response_round_trip(self):
75
+ sample = {"patient_id": "p1", "complications": {"renal": None},
76
+ "literal.key": "value", r"path\key": True}
77
+ response = self.meta.EntitiesResponse()
78
+ document = response.entities.add().document
79
+ document.namespace_name = "patients_symptoms"
80
+ document.collection_name = "symptoms"
81
+ document.fields.add(field_path="patient_id", type_name="string", is_optional=False)
82
+ document.fields.add(field_path="complications", type_name="object", is_optional=True)
83
+ document.fields.add(field_path="complications.renal", type_name="null", is_optional=True)
84
+ document.fields.add(field_path=r"literal\.key", type_name="string", is_optional=False)
85
+ document.fields.add(field_path=r"path\\key", type_name="bool", is_optional=False)
86
+ document.sample_document_json = json.dumps(sample)
87
+ document.document_indexes.add(field_path="patient_id", index_type="hash", unique=True)
88
+ document.document_indexes.add(field_path="complications.renal", index_type="btree", unique=False)
89
+ document.document_indexes.add(field_path=r"literal\.key", index_type="hash", unique=False)
90
+
91
+ result = self.meta.EntitiesResponse.FromString(response.SerializeToString())
92
+ self.assertEqual(result, response)
93
+ self.assertEqual(result.entities[0].WhichOneof("Entity"), "document")
94
+ actual = result.entities[0].document
95
+ self.assertEqual(actual.namespace_name, "patients_symptoms")
96
+ self.assertEqual(actual.collection_name, "symptoms")
97
+ self.assertEqual(
98
+ [(item.field_path, item.type_name, item.is_optional) for item in actual.fields],
99
+ [("patient_id", "string", False), ("complications", "object", True),
100
+ ("complications.renal", "null", True), (r"literal\.key", "string", False),
101
+ (r"path\\key", "bool", False)],
102
+ )
103
+ self.assertTrue(actual.HasField("sample_document_json"))
104
+ self.assertEqual(json.loads(actual.sample_document_json), sample)
105
+ self.assertEqual(
106
+ [(item.field_path, item.index_type, item.unique) for item in actual.document_indexes],
107
+ [("patient_id", "hash", True), ("complications.renal", "btree", False),
108
+ (r"literal\.key", "hash", False)],
109
+ )
110
+
111
+ def test_sample_presence_and_empty_collection(self):
112
+ document = self.meta.Document(namespace_name="ns", collection_name="empty")
113
+ self.assertFalse(document.HasField("sample_document_json"))
114
+ self.assertEqual(list(document.fields), [])
115
+ self.assertEqual(list(document.document_indexes), [])
116
+ copy = self.meta.Document.FromString(document.SerializeToString())
117
+ self.assertFalse(copy.HasField("sample_document_json"))
118
+ document.sample_document_json = ""
119
+ copy = self.meta.Document.FromString(document.SerializeToString())
120
+ self.assertTrue(copy.HasField("sample_document_json"))
121
+ document.ClearField("sample_document_json")
122
+ self.assertFalse(document.HasField("sample_document_json"))
123
+
124
+ def test_document_uses_existing_entity_oneof(self):
125
+ entity = self.meta.Entity()
126
+ entity.document.collection_name = "symptoms"
127
+ self.assertTrue(entity.HasField("document"))
128
+ self.assertFalse(entity.HasField("table"))
129
+ self.assertFalse(entity.HasField("graph"))
130
+ self.assertEqual(entity.DESCRIPTOR.fields_by_name["document"].number, 3)
131
+ entity.table.table_name = "patients"
132
+ self.assertFalse(entity.HasField("document"))
133
+ self.assertEqual(entity.WhichOneof("Entity"), "table")
134
+
135
+ def test_old_empty_document_readers_preserve_unknown_metadata(self):
136
+ # Model the previous empty Document definition in an isolated descriptor pool.
137
+ legacy = descriptor_pb2.FileDescriptorProto(
138
+ name="legacy_document.proto", package="org.polypheny.prism", syntax="proto3"
139
+ )
140
+ legacy.message_type.add(name="Document")
141
+ pool = descriptor_pool.DescriptorPool()
142
+ pool.Add(legacy)
143
+ legacy_document = message_factory.GetMessageClass(
144
+ pool.FindMessageTypeByName("org.polypheny.prism.Document")
145
+ )
146
+ document = self.meta.Document(
147
+ namespace_name="ns", collection_name="symptoms", sample_document_json="{}"
148
+ )
149
+ document.fields.add(field_path="_id", type_name="string", is_optional=False)
150
+ document.document_indexes.add(field_path="_id", index_type="hash", unique=True)
151
+ old_reader = legacy_document.FromString(document.SerializeToString())
152
+ self.assertEqual(
153
+ self.meta.Document.FromString(old_reader.SerializeToString()), document
154
+ )
155
+
156
+
157
+ if __name__ == "__main__":
158
+ unittest.main()
@@ -1,45 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: polypheny-prism-api
3
- Version: 2.0
4
- Summary: Polypheny Prism API files for Python
5
- Home-page: https://polypheny.com/
6
- Author: The Polypheny Project
7
- Author-email: mail@polypheny.org
8
- License: Apache License, Version 2.0
9
- Project-URL: Documentation, https://docs.polypheny.com/en/latest/query_interfaces/prism/protocol
10
- Project-URL: Code, https://github.com/polypheny/Polypheny-Prism-API
11
- Description: # Polypheny-Prism-API
12
- The definition files for the Polypheny Prism API, a multi-model, multi-language query interface.
13
-
14
- The Prism Interface uses Protocol Buffer (protobuf) messages to define it's services. To keep things clear and well-organized, the message definitions are grouped into several files. This simplifies finding specific messages, based on what they do or what part of the system they relate to. The files itself are grouped in categories. Those are expressed in the file names.
15
- Two kinds of categories exist:
16
-
17
- ### Request Response Category
18
-
19
- The category type contains messages that are used in communication adhering to a request, response scheme. Here the client sends a request message to the server upon which the server sends back a response message.
20
-
21
- - **Requests File**: This file contains all messages that are sent from the client to the server. The file name adheres to the following pattern: `[category]_requests.proto`. For example, all the request messages for making or managing connections would be in `connection_requests.proto`.
22
-
23
- - **Responses File**: This is the partner file to Requests. It contains all the messages the server sends back to the client. Following the naming pattern, these files end with `_responses.proto`. The response messages related to connections would thus be in `connection_responses.proto`.
24
-
25
- ### Other Category
26
- The other kind of category contains messages that are not directly used as a response to a request. An example therefore would be messages representing a specific datatype supported by the DBMS.
27
- This category always contains only one file. The filename adheres to the pattern `[category].proto`.
28
-
29
- ### Doc Generator
30
- Detailed Documentation of the proto files their messages and enums and much more can automatically be created using the doc generator included in this repo.
31
- For this to work, the protobuf compiler must be installed. It's current version can be downloaded [here](https://github.com/protocolbuffers/protobuf/releases/).
32
-
33
- To run the doc generator, execute the file `generator.py` in the `doc-generator` directory.
34
-
35
- This creates a directory called docs containing the generated documentation.
36
-
37
- ### Generate Python files
38
-
39
- Generate the Python code:
40
- ```
41
- python -m grpc_tools.protoc -I . --python_out . org/polypheny/prism/*.proto
42
- ```
43
-
44
- Platform: UNKNOWN
45
- Description-Content-Type: text/markdown
@@ -1,45 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: polypheny-prism-api
3
- Version: 2.0
4
- Summary: Polypheny Prism API files for Python
5
- Home-page: https://polypheny.com/
6
- Author: The Polypheny Project
7
- Author-email: mail@polypheny.org
8
- License: Apache License, Version 2.0
9
- Project-URL: Documentation, https://docs.polypheny.com/en/latest/query_interfaces/prism/protocol
10
- Project-URL: Code, https://github.com/polypheny/Polypheny-Prism-API
11
- Description: # Polypheny-Prism-API
12
- The definition files for the Polypheny Prism API, a multi-model, multi-language query interface.
13
-
14
- The Prism Interface uses Protocol Buffer (protobuf) messages to define it's services. To keep things clear and well-organized, the message definitions are grouped into several files. This simplifies finding specific messages, based on what they do or what part of the system they relate to. The files itself are grouped in categories. Those are expressed in the file names.
15
- Two kinds of categories exist:
16
-
17
- ### Request Response Category
18
-
19
- The category type contains messages that are used in communication adhering to a request, response scheme. Here the client sends a request message to the server upon which the server sends back a response message.
20
-
21
- - **Requests File**: This file contains all messages that are sent from the client to the server. The file name adheres to the following pattern: `[category]_requests.proto`. For example, all the request messages for making or managing connections would be in `connection_requests.proto`.
22
-
23
- - **Responses File**: This is the partner file to Requests. It contains all the messages the server sends back to the client. Following the naming pattern, these files end with `_responses.proto`. The response messages related to connections would thus be in `connection_responses.proto`.
24
-
25
- ### Other Category
26
- The other kind of category contains messages that are not directly used as a response to a request. An example therefore would be messages representing a specific datatype supported by the DBMS.
27
- This category always contains only one file. The filename adheres to the pattern `[category].proto`.
28
-
29
- ### Doc Generator
30
- Detailed Documentation of the proto files their messages and enums and much more can automatically be created using the doc generator included in this repo.
31
- For this to work, the protobuf compiler must be installed. It's current version can be downloaded [here](https://github.com/protocolbuffers/protobuf/releases/).
32
-
33
- To run the doc generator, execute the file `generator.py` in the `doc-generator` directory.
34
-
35
- This creates a directory called docs containing the generated documentation.
36
-
37
- ### Generate Python files
38
-
39
- Generate the Python code:
40
- ```
41
- python -m grpc_tools.protoc -I . --python_out . org/polypheny/prism/*.proto
42
- ```
43
-
44
- Platform: UNKNOWN
45
- Description-Content-Type: text/markdown
@@ -1 +0,0 @@
1
- 2.0