platypush/plugins/db/__init__.py
def delete(self, table, records, engine=None, *args, **kwargs):
        """
        Deletes records from a table.

        :param table: Table name
        :type table: str
        :param records: Records to be deleted, as a list of dictionaries
        :type records: list
        :param engine: Engine to be used (default: default class engine)
        :type engine: str
        :param args: Extra arguments that will be passed to ``sqlalchemy.create_engine`` (see https://docs.sqlalchemy.org/en/latest/core/engines.html)
        :param kwargs: Extra kwargs that will be passed to ``sqlalchemy.create_engine`` (seehttps:///docs.sqlalchemy.org/en/latest/core/engines.html)

        Example:

            Request::

                {
                    "type": "request",
                    "target": "your_host",
                    "action": "db.delete",
                    "args": {
                        "table": "table",
                        "engine": "sqlite:///:memory:",
                        "records": [
                            { "id": 1 },
                            { "id": 2 }
                        ]
                    }
                }
        """

        engine = self._get_engine(engine, *args, **kwargs)

        for record in records:
            table, engine = self._get_table(table, engine=engine, *args, **kwargs)
            delete = table.delete()

            for (k,v) in record.items():
                delete = delete.where(self._build_condition(table, k, v))

            engine.execute(delete)

        Deletes records from a table.

        :param table: Table name
        :type table: str
        :param records: Records to be deleted, as a list of dictionaries
        :type records: list
        :param engine: Engine to be used (default: default class engine)
        :type engine: str
        :param args: Extra arguments that will be passed to ``sqlalchemy.create_engine`` (see https://docs.sqlalchemy.org/en/latest/core/engines.html)
        :param kwargs: Extra kwargs that will be passed to ``sqlalchemy.create_engine`` (seehttps:///docs.sqlalchemy.org/en/latest/core/engines.html)

        Example:

            Request::

                {
                    "type": "request",
                    "target": "your_host",
                    "action": "db.delete",
                    "args": {
                        "table": "table",
                        "engine": "sqlite:///:memory:",
                        "records": [
                            { "id": 1 },
                            { "id": 2 }
                        ]
                    }
                }
        
Deletes records from a table.
Deletes records from a table .
def delete(self, table, records, engine=None, *args, **kwargs):
        engine = self._get_engine(engine, *args, **kwargs)
        for record in records:
            table, engine = self._get_table(table, engine=engine, *args, **kwargs)
            delete = table.delete()
            for (k,v) in record.items():
                delete = delete.where(self._build_condition(table, k, v))
            engine.execute(delete)
def delete ( self , table , records , engine = None , * args , ** kwargs ) : engine = self . _get_engine ( engine , * args , ** kwargs ) for record in records : table , engine = self . _get_table ( table , engine = engine , * args , ** kwargs ) delete = table . delete ( ) for ( k , v ) in record . items ( ) : delete = delete . where ( self . _build_condition ( table , k , v ) ) engine . execute ( delete )
Deletes records from a table.
Deletes records from a table .
"""
        Deletes records from a table.

        :param table: Table name
        :type table: str
        :param records: Records to be deleted, as a list of dictionaries
        :type records: list
        :param engine: Engine to be used (default: default class engine)
        :type engine: str
        :param args: Extra arguments that will be passed to ``sqlalchemy.create_engine`` (see https://docs.sqlalchemy.org/en/latest/core/engines.html)
        :param kwargs: Extra kwargs that will be passed to ``sqlalchemy.create_engine`` (seehttps:///docs.sqlalchemy.org/en/latest/core/engines.html)

        Example:

            Request::

                {
                    "type": "request",
                    "target": "your_host",
                    "action": "db.delete",
                    "args": {
                        "table": "table",
                        "engine": "sqlite:///:memory:",
                        "records": [
                            { "id": 1 },
                            { "id": 2 }
                        ]
                    }
                }
        """
self
table
None
records
Records to be deleted, as a list of dictionaries
Records to be deleted as a list of dictionaries
engine
Engine to be used (default: default class engine)
Engine to be used ( default : default class engine )
args
Extra arguments that will be passed to ``sqlalchemy.create_engine``
Extra arguments that will be passed to ` ` sqlalchemy . create_engine ` `
kwargs
Extra kwargs that will be passed to ``sqlalchemy.create_engine``
Example.




Extra kwargs that will be passed to ` ` sqlalchemy . create_engine ` ` Example .