MCPcopy Create free account
hub / github.com/zzzeek/sqlalchemy / delete_path

Method delete_path

lib/sqlalchemy/dialects/postgresql/json.py:369–383  ·  view source on GitHub ↗

JSONB expression. Deletes field or array element specified in the argument array (equivalent of the ``#-`` operator). The input may be a list of strings that will be coerced to an ``ARRAY`` or an instance of :meth:`_postgres.array`. .. versionadded::

(
            self, array: Union[List[str], _pg_array[str]]
        )

Source from the content-addressed store, hash-verified

367 )
368
369 def delete_path(
370 self, array: Union[List[str], _pg_array[str]]
371 ) -> ColumnElement[_CT_JSON]:
372 """JSONB expression. Deletes field or array element specified in
373 the argument array (equivalent of the ``#-`` operator).
374
375 The input may be a list of strings that will be coerced to an
376 ``ARRAY`` or an instance of :meth:`_postgres.array`.
377
378 .. versionadded:: 2.0
379 """
380 if not isinstance(array, _pg_array):
381 array = _pg_array(array)
382 right_side = cast(array, ARRAY(sqltypes.TEXT))
383 return self.operate(DELETE_PATH, right_side, result_type=JSONB)
384
385 def path_exists(self, other: Any) -> ColumnElement[bool]:
386 """Boolean expression. Test for presence of item given by the

Callers 1

test_delete_pathMethod · 0.80

Calls 3

operateMethod · 0.95
ARRAYClass · 0.70
castFunction · 0.50

Tested by 1

test_delete_pathMethod · 0.64