linkml-store 0.1.7__tar.gz → 0.1.9__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.

Potentially problematic release.


This version of linkml-store might be problematic. Click here for more details.

Files changed (53) hide show
  1. {linkml_store-0.1.7 → linkml_store-0.1.9}/PKG-INFO +7 -1
  2. {linkml_store-0.1.7 → linkml_store-0.1.9}/README.md +2 -0
  3. {linkml_store-0.1.7 → linkml_store-0.1.9}/pyproject.toml +8 -2
  4. {linkml_store-0.1.7 → linkml_store-0.1.9}/src/linkml_store/api/client.py +32 -5
  5. {linkml_store-0.1.7 → linkml_store-0.1.9}/src/linkml_store/api/collection.py +276 -27
  6. {linkml_store-0.1.7 → linkml_store-0.1.9}/src/linkml_store/api/config.py +6 -2
  7. {linkml_store-0.1.7 → linkml_store-0.1.9}/src/linkml_store/api/database.py +264 -21
  8. linkml_store-0.1.9/src/linkml_store/api/stores/chromadb/__init__.py +7 -0
  9. {linkml_store-0.1.7 → linkml_store-0.1.9}/src/linkml_store/api/stores/duckdb/__init__.py +9 -0
  10. {linkml_store-0.1.7 → linkml_store-0.1.9}/src/linkml_store/api/stores/duckdb/duckdb_collection.py +7 -4
  11. {linkml_store-0.1.7 → linkml_store-0.1.9}/src/linkml_store/api/stores/duckdb/duckdb_database.py +19 -5
  12. {linkml_store-0.1.7 → linkml_store-0.1.9}/src/linkml_store/api/stores/duckdb/mappings.py +1 -0
  13. linkml_store-0.1.9/src/linkml_store/api/stores/filesystem/__init__.py +15 -0
  14. linkml_store-0.1.9/src/linkml_store/api/stores/filesystem/filesystem_collection.py +177 -0
  15. linkml_store-0.1.9/src/linkml_store/api/stores/filesystem/filesystem_database.py +72 -0
  16. linkml_store-0.1.9/src/linkml_store/api/stores/hdf5/__init__.py +7 -0
  17. linkml_store-0.1.9/src/linkml_store/api/stores/mongodb/__init__.py +25 -0
  18. {linkml_store-0.1.7 → linkml_store-0.1.9}/src/linkml_store/api/stores/mongodb/mongodb_collection.py +31 -10
  19. {linkml_store-0.1.7 → linkml_store-0.1.9}/src/linkml_store/api/stores/mongodb/mongodb_database.py +13 -2
  20. linkml_store-0.1.9/src/linkml_store/api/types.py +4 -0
  21. {linkml_store-0.1.7 → linkml_store-0.1.9}/src/linkml_store/cli.py +150 -15
  22. {linkml_store-0.1.7 → linkml_store-0.1.9}/src/linkml_store/index/__init__.py +6 -2
  23. linkml_store-0.1.9/src/linkml_store/index/implementations/llm_indexer.py +122 -0
  24. {linkml_store-0.1.7 → linkml_store-0.1.9}/src/linkml_store/index/implementations/simple_indexer.py +2 -2
  25. {linkml_store-0.1.7 → linkml_store-0.1.9}/src/linkml_store/index/indexer.py +32 -8
  26. linkml_store-0.1.9/src/linkml_store/utils/change_utils.py +17 -0
  27. linkml_store-0.1.9/src/linkml_store/utils/format_utils.py +224 -0
  28. linkml_store-0.1.9/src/linkml_store/utils/patch_utils.py +126 -0
  29. linkml_store-0.1.9/src/linkml_store/utils/query_utils.py +89 -0
  30. linkml_store-0.1.7/src/linkml_store/api/stores/chromadb/__init__.py +0 -3
  31. linkml_store-0.1.7/src/linkml_store/index/implementations/__init__.py +0 -0
  32. linkml_store-0.1.7/src/linkml_store/index/implementations/llm_indexer.py +0 -44
  33. linkml_store-0.1.7/src/linkml_store/utils/__init__.py +0 -0
  34. linkml_store-0.1.7/src/linkml_store/utils/format_utils.py +0 -93
  35. {linkml_store-0.1.7 → linkml_store-0.1.9}/LICENSE +0 -0
  36. {linkml_store-0.1.7 → linkml_store-0.1.9}/src/linkml_store/__init__.py +0 -0
  37. {linkml_store-0.1.7 → linkml_store-0.1.9}/src/linkml_store/api/__init__.py +0 -0
  38. {linkml_store-0.1.7 → linkml_store-0.1.9}/src/linkml_store/api/queries.py +0 -0
  39. {linkml_store-0.1.7 → linkml_store-0.1.9}/src/linkml_store/api/stores/__init__.py +0 -0
  40. {linkml_store-0.1.7 → linkml_store-0.1.9}/src/linkml_store/api/stores/chromadb/chromadb_collection.py +0 -0
  41. {linkml_store-0.1.7 → linkml_store-0.1.9}/src/linkml_store/api/stores/chromadb/chromadb_database.py +0 -0
  42. {linkml_store-0.1.7 → linkml_store-0.1.9}/src/linkml_store/api/stores/hdf5/hdf5_collection.py +0 -0
  43. {linkml_store-0.1.7 → linkml_store-0.1.9}/src/linkml_store/api/stores/hdf5/hdf5_database.py +0 -0
  44. {linkml_store-0.1.7 → linkml_store-0.1.9}/src/linkml_store/api/stores/solr/__init__.py +0 -0
  45. {linkml_store-0.1.7 → linkml_store-0.1.9}/src/linkml_store/api/stores/solr/solr_collection.py +0 -0
  46. {linkml_store-0.1.7 → linkml_store-0.1.9}/src/linkml_store/api/stores/solr/solr_database.py +0 -0
  47. {linkml_store-0.1.7 → linkml_store-0.1.9}/src/linkml_store/api/stores/solr/solr_utils.py +0 -0
  48. {linkml_store-0.1.7 → linkml_store-0.1.9}/src/linkml_store/constants.py +0 -0
  49. {linkml_store-0.1.7/src/linkml_store/api/stores/hdf5 → linkml_store-0.1.9/src/linkml_store/index/implementations}/__init__.py +0 -0
  50. {linkml_store-0.1.7/src/linkml_store/api/stores/mongodb → linkml_store-0.1.9/src/linkml_store/utils}/__init__.py +0 -0
  51. {linkml_store-0.1.7 → linkml_store-0.1.9}/src/linkml_store/utils/io.py +0 -0
  52. {linkml_store-0.1.7 → linkml_store-0.1.9}/src/linkml_store/utils/object_utils.py +0 -0
  53. {linkml_store-0.1.7 → linkml_store-0.1.9}/src/linkml_store/utils/sql_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: linkml-store
3
- Version: 0.1.7
3
+ Version: 0.1.9
4
4
  Summary: linkml-store
5
5
  License: MIT
6
6
  Author: Author 1
@@ -19,6 +19,7 @@ Provides-Extra: h5py
19
19
  Provides-Extra: llm
20
20
  Provides-Extra: map
21
21
  Provides-Extra: mongodb
22
+ Provides-Extra: pyarrow
22
23
  Provides-Extra: tests
23
24
  Provides-Extra: validation
24
25
  Requires-Dist: black (>=24.0.0) ; extra == "tests"
@@ -27,6 +28,8 @@ Requires-Dist: click
27
28
  Requires-Dist: duckdb (>=0.10.1,<0.11.0)
28
29
  Requires-Dist: duckdb-engine (>=0.11.2)
29
30
  Requires-Dist: h5py ; extra == "h5py"
31
+ Requires-Dist: jinja2 (>=3.1.4,<4.0.0)
32
+ Requires-Dist: jsonlines (>=4.0.0,<5.0.0)
30
33
  Requires-Dist: linkml ; extra == "validation"
31
34
  Requires-Dist: linkml-runtime (>=1.7.5,<2.0.0)
32
35
  Requires-Dist: linkml_map ; extra == "map"
@@ -34,6 +37,7 @@ Requires-Dist: llm ; extra == "llm"
34
37
  Requires-Dist: matplotlib ; extra == "analytics"
35
38
  Requires-Dist: pandas (>=2.2.1) ; extra == "analytics"
36
39
  Requires-Dist: plotly ; extra == "analytics"
40
+ Requires-Dist: pyarrow ; extra == "pyarrow"
37
41
  Requires-Dist: pydantic (>=2.0.0,<3.0.0)
38
42
  Requires-Dist: pymongo ; extra == "mongodb"
39
43
  Requires-Dist: pystow (>=0.5.4,<0.6.0)
@@ -53,3 +57,5 @@ There is also experimental support for vector-based indexing using OpenAI test e
53
57
  The goals of this project are to provide high level access to data stored in heterogeneous databases,
54
58
  with optional schema management using LinkML.
55
59
 
60
+ See [these slides](https://docs.google.com/presentation/d/e/2PACX-1vSgtWUNUW0qNO_ZhMAGQ6fYhlXZJjBNMYT0OiZz8DDx8oj7iG9KofRs6SeaMXBBOICGknoyMG2zaHnm/embed?start=false&loop=false&delayms=3000) for more details
61
+
@@ -8,3 +8,5 @@ There is also experimental support for vector-based indexing using OpenAI test e
8
8
 
9
9
  The goals of this project are to provide high level access to data stored in heterogeneous databases,
10
10
  with optional schema management using LinkML.
11
+
12
+ See [these slides](https://docs.google.com/presentation/d/e/2PACX-1vSgtWUNUW0qNO_ZhMAGQ6fYhlXZJjBNMYT0OiZz8DDx8oj7iG9KofRs6SeaMXBBOICGknoyMG2zaHnm/embed?start=false&loop=false&delayms=3000) for more details
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "linkml-store"
3
- version = "0.1.7"
3
+ version = "0.1.9"
4
4
  description = "linkml-store"
5
5
  authors = ["Author 1 <author@org.org>"]
6
6
  license = "MIT"
@@ -23,10 +23,13 @@ black = { version=">=24.0.0", optional = true }
23
23
  llm = { version="*", optional = true }
24
24
  pymongo = { version="*", optional = true }
25
25
  chromadb = { version="*", optional = true }
26
+ pyarrow = { version="*", optional = true }
26
27
  h5py = { version="*", optional = true }
27
28
  linkml = { version="*", optional = true }
28
29
  linkml_map = { version="*", optional = true }
29
30
  pandas = ">=2.2.1"
31
+ jinja2 = "^3.1.4"
32
+ jsonlines = "^4.0.0"
30
33
 
31
34
  [tool.poetry.group.dev.dependencies]
32
35
  pytest = {version = ">=7.1.2"}
@@ -41,6 +44,8 @@ myst-parser = {version = ">=0.18.1"}
41
44
  furo = {version = "*"}
42
45
  nbsphinx = "*"
43
46
  jupyter = "*"
47
+ jupysql = "*"
48
+ papermill = "*"
44
49
 
45
50
  [tool.poetry.group.tests.dependencies]
46
51
  pytest = "^7.4.0"
@@ -58,6 +63,7 @@ llm = ["llm"]
58
63
  mongodb = ["pymongo"]
59
64
  chromadb = ["chromadb"]
60
65
  h5py = ["h5py"]
66
+ pyarrow = ["pyarrow"]
61
67
  validation = ["linkml"]
62
68
  map = ["linkml_map"]
63
69
 
@@ -125,7 +131,7 @@ skip = '.git,*.pdf,*.svg,./tests,pyproject.toml,*.dill,poetry.lock,*.ipynb'
125
131
  # Ignore table where words could be split across rows
126
132
  # Ignore shortcut specifications like [Ff]alse
127
133
  ignore-regex = '(\|.*\|.*\|.*\||\[[A-Z][a-z]\][a-z][a-z])'
128
- ignore-words-list = 'mater,connexion,infarction'
134
+ ignore-words-list = 'mater,connexion,infarction,nin'
129
135
  count = ""
130
136
  quiet-level = 3
131
137
 
@@ -1,3 +1,4 @@
1
+ import logging
1
2
  from pathlib import Path
2
3
  from typing import Dict, Optional, Union
3
4
 
@@ -8,14 +9,19 @@ from linkml_store.api import Database
8
9
  from linkml_store.api.config import ClientConfig
9
10
  from linkml_store.api.stores.chromadb.chromadb_database import ChromaDBDatabase
10
11
  from linkml_store.api.stores.duckdb.duckdb_database import DuckDBDatabase
12
+ from linkml_store.api.stores.filesystem.filesystem_database import FileSystemDatabase
11
13
  from linkml_store.api.stores.mongodb.mongodb_database import MongoDBDatabase
12
14
  from linkml_store.api.stores.solr.solr_database import SolrDatabase
13
15
 
16
+ logger = logging.getLogger(__name__)
17
+
18
+
14
19
  HANDLE_MAP = {
15
20
  "duckdb": DuckDBDatabase,
16
21
  "solr": SolrDatabase,
17
22
  "mongodb": MongoDBDatabase,
18
23
  "chromadb": ChromaDBDatabase,
24
+ "file": FileSystemDatabase,
19
25
  }
20
26
 
21
27
 
@@ -23,14 +29,27 @@ class Client:
23
29
  """
24
30
  A client is the top-level object for interacting with databases.
25
31
 
26
- A client has access to one or more :class:`Database` objects.
27
-
28
- Each database consists of a number of :class:`.Collection` objects.
32
+ * A client has access to one or more :class:`.Database` objects.
33
+ * Each database consists of a number of :class:`.Collection` objects.
29
34
 
30
- Examples
31
- --------
35
+ Creating a client
36
+ -----------------
32
37
  >>> client = Client()
38
+
39
+ Attaching a database
40
+ --------------------
33
41
  >>> db = client.attach_database("duckdb", alias="test")
42
+
43
+ Note that normally a handle would be specified by a locator such as ``duckdb:///<PATH>``, but
44
+ for convenience, an in-memory duckdb object can be specified without a full locator
45
+
46
+ We can check the actual handle:
47
+
48
+ >>> db.handle
49
+ 'duckdb:///:memory:'
50
+
51
+ Creating a new collection
52
+ -------------------------
34
53
  >>> collection = db.create_collection("Person")
35
54
  >>> objs = [{"id": "P1", "name": "John", "age_in_years": 30}, {"id": "P2", "name": "Alice", "age_in_years": 25}]
36
55
  >>> collection.insert(objs)
@@ -151,6 +170,8 @@ class Client:
151
170
  if ":" not in handle:
152
171
  scheme = handle
153
172
  handle = None
173
+ if alias is None:
174
+ alias = scheme
154
175
  else:
155
176
  scheme, _ = handle.split(":", 1)
156
177
  if scheme not in HANDLE_MAP:
@@ -165,6 +186,11 @@ class Client:
165
186
  self._databases = {}
166
187
  self._databases[alias] = db
167
188
  db.parent = self
189
+ if db.alias:
190
+ if db.alias != alias:
191
+ raise AssertionError(f"Inconsistent alias: {db.alias} != {alias}")
192
+ else:
193
+ db.metadata.alias = alias
168
194
  return db
169
195
 
170
196
  def get_database(self, name: Optional[str] = None, create_if_not_exists=True, **kwargs) -> Database:
@@ -195,6 +221,7 @@ class Client:
195
221
  self._databases = {}
196
222
  if name not in self._databases:
197
223
  if create_if_not_exists:
224
+ logger.info(f"Creating database: {name}")
198
225
  self.attach_database(name, **kwargs)
199
226
  else:
200
227
  raise ValueError(f"Database {name} does not exist")