inputlayer-client-dev 0.1.0.dev919__py3-none-any.whl → 0.1.0.dev924__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.
inputlayer/compiler.py CHANGED
@@ -666,6 +666,17 @@ def compile_rule(
666
666
  else:
667
667
  head_parts.append(column_to_variable(col))
668
668
 
669
+ # Compile filter conditions BEFORE building body atoms, so every column
670
+ # the condition references is registered in the env and gets bound to a
671
+ # variable in its atom. Compiling them after produced atoms with `_` for
672
+ # condition-only columns while the condition referenced an unbound
673
+ # variable - which the engine accepts and silently satisfies, deriving
674
+ # wrong results (e.g. a tier == "gold" filter matching every row).
675
+ cond_parts: list[str] = []
676
+ if condition:
677
+ cond_parts = compile_bool_expr(condition, env)
678
+ cond_parts = [p for p in cond_parts if p]
679
+
669
680
  # Build body atoms
670
681
  body_atoms: list[str] = []
671
682
  for rn, cls, alias in body_relations:
@@ -680,12 +691,6 @@ def compile_rule(
680
691
  atom_parts.append("_")
681
692
  body_atoms.append(f"{rn}({', '.join(atom_parts)})")
682
693
 
683
- # Compile filter conditions
684
- cond_parts: list[str] = []
685
- if condition:
686
- cond_parts = compile_bool_expr(condition, env)
687
- cond_parts = [p for p in cond_parts if p]
688
-
689
694
  all_body = body_atoms + cond_parts
690
695
  prefix = "+" if persistent else ""
691
696
  head_str = f"{prefix}{head_name}({', '.join(head_parts)})"
@@ -963,11 +963,22 @@ class KnowledgeGraph:
963
963
  )
964
964
 
965
965
  async def load(self, path: str, *, mode: str | None = None) -> None:
966
- """Load data from a file."""
967
- cmd = f".load {path}"
968
- if mode:
969
- cmd += f" {mode}"
970
- await self._execute(cmd)
966
+ """Load an IQL file into this knowledge graph.
967
+
968
+ The file is read locally and sent to the server as a single
969
+ multi-statement program, so the load is atomic: the server parses
970
+ every statement before executing any, and rejects the whole
971
+ program on the first error.
972
+
973
+ (Sending ``.load`` over the wire does not work: the server treats
974
+ it as a client-only REPL command and silently ignores it.)
975
+ """
976
+ if mode is not None:
977
+ msg = "load(mode=...) is not supported; --replace/--merge are unimplemented server-side"
978
+ raise NotImplementedError(msg)
979
+ with open(path, encoding="utf-8") as f:
980
+ program = f.read()
981
+ await self._execute(program)
971
982
 
972
983
  async def clear_prefix(self, prefix: str) -> ClearResult:
973
984
  """Clear all relations matching a prefix."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: inputlayer-client-dev
3
- Version: 0.1.0.dev919
3
+ Version: 0.1.0.dev924
4
4
  Summary: Python Object-Logic Mapper for InputLayer knowledge graph engine
5
5
  License-Expression: Apache-2.0
6
6
  License-File: LICENSE
@@ -8,13 +8,13 @@ inputlayer/aggregations.py,sha256=qQm9PUxTZGCIfCThexrD3wa71327pshI9wJCLkFJI74,29
8
8
  inputlayer/auth.py,sha256=Vp3Jkx9cQUTjPX31cpMIIkPDoBWmjalg1kcyxeYl8pA,3249
9
9
  inputlayer/client.py,sha256=U8zBp0srmTFmzFY626IbrXtlaXbxlWj5Cj_R1vtD17I,7584
10
10
  inputlayer/client_sync.py,sha256=Dz38mRQT3Mc7wwmOYgVQP9dBCVgMFIESATmy7fBYAjc,8346
11
- inputlayer/compiler.py,sha256=3ELVDd0dRNCSLjvQcUQ7paFdqFra5sznWGrrTfvhCwg,24378
11
+ inputlayer/compiler.py,sha256=5YMFZO6sl6lZ63fUH2bCb-PEl1QK_sbB1ntdHRjmi-k,24792
12
12
  inputlayer/connection.py,sha256=tYbRH5Q1OzR1KfguSEhfZ1LXTeX708OIdp-yatbMeoA,13772
13
13
  inputlayer/derived.py,sha256=ngjuYmKY88ZSnmb4RiTB2bDEr9buzoM15J6NdKqhSNo,4793
14
14
  inputlayer/exceptions.py,sha256=6b2WEkpfLnf02MLyXzXA8ohUqIwXFdo4RDWw46FINH8,2712
15
15
  inputlayer/functions.py,sha256=oQt4KrVuNQE0Kca16xzIpV0ChkmQ28q9PoDECz5Jqyc,10141
16
16
  inputlayer/index.py,sha256=PadO54xqzdmV3Dj-FuAHPYKsn4iC1JkblliZeUm9L2M,1077
17
- inputlayer/knowledge_graph.py,sha256=weT19O1cmCRGwJuQ5myDWGP1xC4T8eRjUbFLEMZlBjY,37365
17
+ inputlayer/knowledge_graph.py,sha256=tyZHce3ItPTxhPw2FR6RQc7qyBAL7QUAjIHrhl3JgUo,37963
18
18
  inputlayer/notifications.py,sha256=Osm3Q18NrTWj0g_KbnY1jWcc50n0qIz-Lojypy5w-bg,3213
19
19
  inputlayer/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
20
  inputlayer/relation.py,sha256=SU0f6ax4ib6H5llOqgLMSVXJVIdwHf5EoSOUv5YIL-g,3727
@@ -48,8 +48,8 @@ inputlayer/migrations/operations.py,sha256=_qiguq0GFcXVZgIJa4vHu7eeKSa5BUh2maDce
48
48
  inputlayer/migrations/recorder.py,sha256=qARvQKL_s84vWTEEuHFAmVPvAZiTYCW4X-HtLIdpnbA,3282
49
49
  inputlayer/migrations/state.py,sha256=BH5_ly9I9bVPn1lvhqS_UWS7NvYg2iCLJrbG50-mwlQ,3695
50
50
  inputlayer/migrations/writer.py,sha256=4EZjKTu10pry-3vVchg36I9aNHs-zavLzJeDbZd2rko,1497
51
- inputlayer_client_dev-0.1.0.dev919.dist-info/METADATA,sha256=Phc3S1tyjDGytvgk6NofH6D6zjZU5CYrDMGdaBkKPXI,19942
52
- inputlayer_client_dev-0.1.0.dev919.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
53
- inputlayer_client_dev-0.1.0.dev919.dist-info/entry_points.txt,sha256=xEo6y283VSdmZ4G_KSh1-Cpl3ZPmgM6x9OLT8VJcrqs,70
54
- inputlayer_client_dev-0.1.0.dev919.dist-info/licenses/LICENSE,sha256=zed5l9sdToIBMxqe_4I7nX1NTIlqxzT_PBO3rj7-ax4,11281
55
- inputlayer_client_dev-0.1.0.dev919.dist-info/RECORD,,
51
+ inputlayer_client_dev-0.1.0.dev924.dist-info/METADATA,sha256=E52crRqR19jcIyBghqDAmKFJmUVGX-USJJC4QVOZcdY,19942
52
+ inputlayer_client_dev-0.1.0.dev924.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
53
+ inputlayer_client_dev-0.1.0.dev924.dist-info/entry_points.txt,sha256=xEo6y283VSdmZ4G_KSh1-Cpl3ZPmgM6x9OLT8VJcrqs,70
54
+ inputlayer_client_dev-0.1.0.dev924.dist-info/licenses/LICENSE,sha256=zed5l9sdToIBMxqe_4I7nX1NTIlqxzT_PBO3rj7-ax4,11281
55
+ inputlayer_client_dev-0.1.0.dev924.dist-info/RECORD,,