### Navigation

- index
- modules |
- next |
- previous |
- Camelot documentation »
- Camelot API »
- view »
- proxy »

# queryproxy

Proxies representing the results of a query

class `camelot.view.proxy.queryproxy.``QueryTableProxy`(admin, query_getter, columns_getter, max_number_of_rows=10, edits=None, cache_collection_proxy=None)

  The QueryTableProxy contains a limited copy of the data in the SQLAlchemy model, which is fetched from the database to be used as the model for a QTableView

  `append`(o)

    Add an object to this collection, used when inserting a new row, overwrite this method for specific behaviour in subclasses

  `getData`(*args, **kwargs)

    Generator for all the data queried by this proxy

  `get_collection`()

    In case the collection is requested of a QueryProxy, we will return a collection getter for a collection that reuses the data already queried by the collection proxy, and available in the cache.

    We do this to :

    1. Prevent an unneeded query when the collection is used to fetch an object already fetched by the query proxy (eg when a form is opened on a table view)
    2. To make sure the index of an object in the query proxy is the same as the index in the returned collection. Should we do the same query twice (once to fill the query proxy, and once to fill the returned collection), the same object might appear in a different row. eg when a form is opened in a table view, the form contains another record than the selected row in the table.
  `setQuery`(*args, **kwargs)

    Set the query and refresh the view

  `sort`(*args, **kwargs)

    Overwrites the `QAbstractItemModel.sort()` method

### Navigation

- index
- modules |
- next |
- previous |
- Camelot documentation »
- Camelot API »
- view »
- proxy »

Comments
blog comments powered by Disqus