## queries.BaseQuery


Base class for all query types.


Usage

``` python
queries.BaseQuery(table)
```


## Methods

| Name | Description |
|----|----|
| [__init__()](#__init__) | Initialize a new query. |
| [__repr__()](#__repr__) | Get nice string representation. |
| [by_muid()](#by_muid) | Filter the query by one or more MUIDs. |
| [execute()](#execute) | Execute the query against the database. |
| [reset()](#reset) | Reset the query execution status to allow re-execution. |
| [where()](#where) | Add a WHERE condition to the query. |

------------------------------------------------------------------------


#### \_\_init\_\_()


Initialize a new query.


Usage

``` python
__init__(table)
```


##### Parameters


`table: BaseTable`  
The table this query operates on


------------------------------------------------------------------------


#### \_\_repr\_\_()


Get nice string representation.


Usage

``` python
__repr__()
```


##### Returns


`str`  
The query type, table name and whether it has been executed.


------------------------------------------------------------------------


#### by_muid()


Filter the query by one or more MUIDs.


Usage

``` python
by_muid(muid_or_muids)
```


##### Parameters


`muid_or_muids: str or list/tuple of str`  
A single MUID string, or a list/tuple of MUID strings.


##### Returns


`self`  
The query instance for method chaining.


##### Raises


`ValueError`  
If `muid_or_muids` is not a string, or a list/tuple of strings, or if items in list/tuple are not strings.

`ValueError`  
If `muid_or_muids` is an empty list/tuple.


------------------------------------------------------------------------


#### execute()


Execute the query against the database.


Usage

``` python
execute()
```


Template method that handles execution tracking and delegates to \_execute_impl for the actual query execution.


##### Returns


`QueryResultT`  
Query-type dependent result


##### Raises


`RuntimeError`  
If the query has already been executed

`ValueError`  
If the database is not open


------------------------------------------------------------------------


#### reset()


Reset the query execution status to allow re-execution.


Usage

``` python
reset()
```


##### Returns


`self`  
For method chaining


------------------------------------------------------------------------


#### where()


Add a WHERE condition to the query.


Usage

``` python
where(condition)
```


##### Parameters


`condition: str`  
SQL-like condition string


##### Returns


`self`  
For method chaining
