class SQLInsertCompiler(SQLCompiler): (source)
Known subclasses: django.db.backends.mysql.compiler.SQLInsertCompiler
Undocumented
Method | as |
Create the SQL for this query. Return the SQL string and list of parameters. |
Method | assemble |
Take a sequence of N fields and a sequence of M rows of values, and generate placeholder SQL and parameters for each field and value. Return a pair containing: * a sequence of M rows of N SQL placeholder strings, and * a sequence of M rows of corresponding parameter values. |
Method | execute |
Run the query against the database and return the result(s). The return value is a single data item if result_type is SINGLE, or an iterator over the results if the result_type is MULTI. |
Method | field |
Take a field and a value intended to be saved on that field, and return placeholder SQL and accompanying params. Check for raw values, expressions, and fields with get_placeholder() defined in that order. |
Method | pre |
Get the given field's value off the given obj. pre_save() is used for things like auto_now on DateTimeField. Skip it if this is a raw query. |
Method | prepare |
Prepare a value to be used in a query by resolving it if it is an expression and otherwise calling the field's get_db_prep_save(). |
Instance Variable | returning |
Undocumented |
Instance Variable | returning |
Undocumented |
Inherited from SQLCompiler
:
Method | __init__ |
Undocumented |
Method | __repr__ |
Undocumented |
Method | apply |
Undocumented |
Method | as |
Undocumented |
Method | collapse |
Undocumented |
Method | compile |
Undocumented |
Method | deferred |
Convert the self.deferred_loading data structure to mapping of table names to sets of column names which are to be loaded. Return the dictionary. |
Method | explain |
Undocumented |
Method | find |
Return the table alias (the name might be ambiguous, the alias will not be) and column name for ordering by the given 'name' parameter. The 'name' is of the form 'field1__field2__...__fieldN'. |
Method | get |
Undocumented |
Method | get |
Undocumented |
Method | get |
Compute the default columns for selecting every field in the base model. Will sometimes be called to pull in related models (e.g. via select_related), in which case "opts" and "start_alias" will be given to provide a starting point for the traversal. |
Method | get |
Return a quoted list of fields to use in DISTINCT ON part of the query. |
Method | get |
Undocumented |
Method | get |
Return a list of strings that are joined together to go after the "FROM" part of the query, as well as a list any extra parameters that need to be included. Subclasses, can override this to create a from-clause via a "select". |
Method | get |
Return a list of 2-tuples of form (sql, params). |
Method | get |
Return a list of 2-tuples of the form (expr, (sql, params, is_ref)) for the ORDER BY clause. |
Method | get |
Fill in the information needed for a select_related query. The current depth is measured as the number of connections away from the root model (for example, cur_depth=1 means we are looking at models with direct connections to the root model). |
Method | get |
Return three values: - a list of 3-tuples of (expression, (sql, params), alias) - a klass_info structure, - a dictionary of annotations |
Method | get |
Return a quoted list of arguments for the SELECT FOR UPDATE OF part of the query. |
Method | has |
Backends (e.g. NoSQL) can override this in order to use optimized versions of "query has any results." |
Method | pre |
Do any necessary class setup immediately prior to producing SQL. This is for things that can't necessarily be done in __init__ because we might not have all the pieces in place at that time. |
Method | quote |
A wrapper around connection.ops.quote_name that doesn't quote aliases for table names. This avoids problems with some SQL dialects that treat quoted strings specially (e.g. PostgreSQL). |
Method | results |
Return an iterator over the results from executing this query. |
Method | setup |
Undocumented |
Class Variable | ordering |
Undocumented |
Instance Variable | annotation |
Undocumented |
Instance Variable | col |
Undocumented |
Instance Variable | connection |
Undocumented |
Instance Variable | elide |
Undocumented |
Instance Variable | has |
Undocumented |
Instance Variable | having |
Undocumented |
Instance Variable | klass |
Undocumented |
Instance Variable | query |
Undocumented |
Instance Variable | quote |
Undocumented |
Instance Variable | select |
Undocumented |
Instance Variable | using |
Undocumented |
Instance Variable | where |
Undocumented |
Method | _order |
Undocumented |
Method | _setup |
Helper method for get_order_by() and get_distinct(). |
Instance Variable | _meta |
Undocumented |
Create the SQL for this query. Return the SQL string and list of parameters. If 'with_limits' is False, any limit/offset information is not included in the query.
Take a sequence of N fields and a sequence of M rows of values, and generate placeholder SQL and parameters for each field and value. Return a pair containing: * a sequence of M rows of N SQL placeholder strings, and * a sequence of M rows of corresponding parameter values. Each placeholder string may contain any number of '%s' interpolation strings, and each parameter row will contain exactly as many params as the total number of '%s's in the corresponding placeholder row.
Run the query against the database and return the result(s). The return value is a single data item if result_type is SINGLE, or an iterator over the results if the result_type is MULTI. result_type is either MULTI (use fetchmany() to retrieve all rows), SINGLE (only retrieve a single row), or None. In this last case, the cursor is returned if any query is executed, since it's used by subclasses such as InsertQuery). It's possible, however, that no query is needed, as the filters describe an empty set. In that case, None is returned, to avoid any unnecessary database interaction.
Take a field and a value intended to be saved on that field, and return placeholder SQL and accompanying params. Check for raw values, expressions, and fields with get_placeholder() defined in that order. When field is None, consider the value raw and use it as the placeholder, with no corresponding parameters returned.
Get the given field's value off the given obj. pre_save() is used for things like auto_now on DateTimeField. Skip it if this is a raw query.