que/query.py
def build_insert(
        self,
        style: ParamStyleType = DEFAULT_PARAM_STYLE,
        *,
        inject_columns: bool = False,
    ) -> Tuple[str, ArgList]:
        """Build a SQL INSERT statement.

        We create two new :class:`FieldList` - one for column declaration and one for values declaration.
        We combine them as a single :class:`ArgList` (order is important!).
        We generate the SQL fragments for the INSERT INTO clause and the VALUES clause.
        We check for a RETURNING clause.
        Finally, we join it all together into one SQL statement.

        Parameters
        --------
        style : defaults :class:`NumParamStyle.NUM`
            The DBAPI 2.0 param-style.
        inject_columns: defaults False
            Inject the column names directly, rather than rely on DBAPI formatting.
            This is necessary for some client, such as ``asyncpg``.

        Returns
        -----
        The generated SQL INSERT statement
        The arguments to pass to the DB client for secure formatting.
        """
        columns = FieldList([Field(f"col{x.name}", x.name) for x in self.fields])
        values = FieldList([Field(f"val{x.name}", x.value) for x in self.fields])
        args = ArgList(values) if inject_columns else ArgList(columns + values)
        insert_sql = self._fields_to_sql(columns, style, args, inject=inject_columns)
        values_sql = self._fields_to_sql(values, style, args)
        returning = self.get_returning()
        return (
            (
                f"INSERT INTO\n  {self.table_name} {insert_sql}\n"
                f"VALUES\n  {values_sql}\n"
                f"{returning}"
            ),
            args,
        )
Build a SQL INSERT statement.

        We create two new :class:`FieldList` - one for column declaration and one for values declaration.
        We combine them as a single :class:`ArgList` (order is important!).
        We generate the SQL fragments for the INSERT INTO clause and the VALUES clause.
        We check for a RETURNING clause.
        Finally, we join it all together into one SQL statement.

        Parameters
        --------
        style : defaults :class:`NumParamStyle.NUM`
            The DBAPI 2.0 param-style.
        inject_columns: defaults False
            Inject the column names directly, rather than rely on DBAPI formatting.
            This is necessary for some client, such as ``asyncpg``.

        Returns
        -----
        The generated SQL INSERT statement
        The arguments to pass to the DB client for secure formatting.
        
Build a SQL INSERT statement.
We create two new :class:`FieldList` - one for column declaration and one for values declaration.
We combine them as a single :class:`ArgList` (order is important!).
We generate the SQL fragments for the INSERT INTO clause and the VALUES clause.
We check for a RETURNING clause.
Finally, we join it all together into one SQL statement.

Parameters



Returns

The generated SQL INSERT statement
The arguments to pass to the DB client for secure formatting.
Build a SQL INSERT statement . We create two new : class : ` FieldList ` - one for column declaration and one for values declaration . We combine them as a single : class : ` ArgList ` ( order is important! ) . We generate the SQL fragments for the INSERT INTO clause and the VALUES clause . We check for a RETURNING clause . Finally we join it all together into one SQL statement . Parameters Returns The generated SQL INSERT statement The arguments to pass to the DB client for secure formatting .
def build_insert(
        self,
        style: ParamStyleType = DEFAULT_PARAM_STYLE,
        *,
        inject_columns: bool = False,
    ) -> Tuple[str, ArgList]:
        columns = FieldList([Field(f"col{x.name}", x.name) for x in self.fields])
        values = FieldList([Field(f"val{x.name}", x.value) for x in self.fields])
        args = ArgList(values) if inject_columns else ArgList(columns + values)
        insert_sql = self._fields_to_sql(columns, style, args, inject=inject_columns)
        values_sql = self._fields_to_sql(values, style, args)
        returning = self.get_returning()
        return (
            (
                f"INSERT INTO\n  {self.table_name} {insert_sql}\n"
                f"VALUES\n  {values_sql}\n"
                f"{returning}"
            ),
            args,
        )
def build_insert ( self , style : ParamStyleType = DEFAULT_PARAM_STYLE , * , inject_columns : bool = False , ) -> Tuple [ str , ArgList ] : columns = FieldList ( [ Field ( f"col{x.name}" , x . name ) for x in self . fields ] ) values = FieldList ( [ Field ( f"val{x.name}" , x . value ) for x in self . fields ] ) args = ArgList ( values ) if inject_columns else ArgList ( columns + values ) insert_sql = self . _fields_to_sql ( columns , style , args , inject = inject_columns ) values_sql = self . _fields_to_sql ( values , style , args ) returning = self . get_returning ( ) return ( ( f"INSERT INTO\n  {self.table_name} {insert_sql}\n" f"VALUES\n  {values_sql}\n" f"{returning}" ) , args , )
Build a SQL INSERT statement.
Build a SQL INSERT statement .
"""Build a SQL INSERT statement.

        We create two new :class:`FieldList` - one for column declaration and one for values declaration.
        We combine them as a single :class:`ArgList` (order is important!).
        We generate the SQL fragments for the INSERT INTO clause and the VALUES clause.
        We check for a RETURNING clause.
        Finally, we join it all together into one SQL statement.

        Parameters
        --------
        style : defaults :class:`NumParamStyle.NUM`
            The DBAPI 2.0 param-style.
        inject_columns: defaults False
            Inject the column names directly, rather than rely on DBAPI formatting.
            This is necessary for some client, such as ``asyncpg``.

        Returns
        -----
        The generated SQL INSERT statement
        The arguments to pass to the DB client for secure formatting.
        """
self
style
ParamStyleType
inject_columns
bool