# Class SQLiteInsertBase<TTable, TResultType, TRunResult, TReturning, TDynamic, TExcludedMethods>

#### Type Parameters

- TTable extends SQLiteTable
- TResultType extends "sync" | "async"
- TRunResult
- TReturning = undefined
- TDynamic extends boolean = false
- TExcludedMethods extends string = never

#### Hierarchy

- SQLWrapper
- QueryPromise<TReturning extends undefined ? TRunResult : TReturning[]>
- RunnableQuery<
  TReturning extends undefined ? TRunResult : TReturning[],
  "sqlite",
  >
  - SQLiteInsertBase

#### Implements

- RunnableQuery<
  TReturning extends undefined ? TRunResult : TReturning[],
  "sqlite",
  >
- SQLWrapper

- Defined in node_modules/.pnpm/drizzle-orm@0.44.6_@cloudflare+workers-types@4.20251014.0_@opentelemetry+api@1.9.0_@typ_31a6f5ca8f102af87864dd251ed08d88/node_modules/drizzle-orm/sqlite-core/query-builders/insert.d.ts:69
- Defined in node_modules/.pnpm/drizzle-orm@0.44.6_@cloudflare+workers-types@4.20251014.0_@opentelemetry+api@1.9.0_@typ_31a6f5ca8f102af87864dd251ed08d88/node_modules/drizzle-orm/sqlite-core/query-builders/insert.d.ts:81

##### Index

### Constructors

constructor

### Properties

_
[toStringTag]
all
get
run
values
[entityKind]

### Methods

$dynamic
catch
execute
finally
getSQL
onConflictDoNothing
onConflictDoUpdate
prepare
returning
shouldOmitSQLParens?
then
toSQL

## Constructors

### constructor

- new SQLiteInsertBase<
  TTable extends SQLiteTable<TableConfig>,
  TResultType extends "sync" | "async",
  TRunResult,
  TReturning = undefined,
  TDynamic extends boolean = false,
  TExcludedMethods extends string = never,
  >(
  table: TTable,
  values:
  | SQL<unknown>
  | Record<string, SQL<unknown> | Param<unknown, unknown>>[]
  | SQLiteInsertSelectQueryBuilder<SQLiteTable<TableConfig>>,
  session: SQLiteSession<any, any, any, any>,
  dialect: SQLiteDialect,
  withList?: Subquery<string, Record<string, unknown>>[],
  select?: boolean,
  ): SQLiteInsertBase<
  TTable,
  TResultType,
  TRunResult,
  TReturning,
  TDynamic,
  TExcludedMethods,
  >

  #### Type Parameters

  - TTable extends SQLiteTable<TableConfig>
  - TResultType extends "sync" | "async"
  - TRunResult
  - TReturning = undefined
  - TDynamic extends boolean = false
  - TExcludedMethods extends string = never

  #### Parameters

  - table: TTable
  - values:
    | SQL<unknown>
    | Record<string, SQL<unknown> | Param<unknown, unknown>>[]
    | SQLiteInsertSelectQueryBuilder<SQLiteTable<TableConfig>>
  - session: SQLiteSession<any, any, any, any>
  - dialect: SQLiteDialect
  - `Optional` withList: Subquery<string, Record<string, unknown>>[]
  - `Optional` select: boolean

  #### Returns SQLiteInsertBase<
  TTable,
  TResultType,
  TRunResult,
  TReturning,
  TDynamic,
  TExcludedMethods,
  >

  Inherited from SQLWrapper.constructor

  - Defined in node_modules/.pnpm/drizzle-orm@0.44.6_@cloudflare+workers-types@4.20251014.0_@opentelemetry+api@1.9.0_@typ_31a6f5ca8f102af87864dd251ed08d88/node_modules/drizzle-orm/sqlite-core/query-builders/insert.d.ts:85

## Properties

### `Readonly`_

_: {
dialect: "sqlite";
dynamic: TDynamic;
excludedMethods: TExcludedMethods;
result: TReturning extends undefined ? TRunResult : TReturning[];
resultType: TResultType;
returning: TReturning;
runResult: TRunResult;
table: TTable;
}

Overrides RunnableQuery._

- Defined in node_modules/.pnpm/drizzle-orm@0.44.6_@cloudflare+workers-types@4.20251014.0_@opentelemetry+api@1.9.0_@typ_31a6f5ca8f102af87864dd251ed08d88/node_modules/drizzle-orm/sqlite-core/query-builders/insert.d.ts:70

### [toStringTag]

"[toStringTag]": string

Inherited from QueryPromise.[toStringTag]

- Defined in node_modules/.pnpm/drizzle-orm@0.44.6_@cloudflare+workers-types@4.20251014.0_@opentelemetry+api@1.9.0_@typ_31a6f5ca8f102af87864dd251ed08d88/node_modules/drizzle-orm/query-promise.d.ts:4

### all

all: (
placeholderValues?: Record<string, unknown>,
) => Result<
TResultType,
TReturning extends undefined
? DrizzleTypeError<".all() cannot be used without .returning()">
: TReturning[],
>

- Defined in node_modules/.pnpm/drizzle-orm@0.44.6_@cloudflare+workers-types@4.20251014.0_@opentelemetry+api@1.9.0_@typ_31a6f5ca8f102af87864dd251ed08d88/node_modules/drizzle-orm/sqlite-core/query-builders/insert.d.ts:167

### get

get: (
placeholderValues?: Record<string, unknown>,
) => Result<
TResultType,
TReturning extends undefined
? DrizzleTypeError<".get() cannot be used without .returning()">
: TReturning,
>

- Defined in node_modules/.pnpm/drizzle-orm@0.44.6_@cloudflare+workers-types@4.20251014.0_@opentelemetry+api@1.9.0_@typ_31a6f5ca8f102af87864dd251ed08d88/node_modules/drizzle-orm/sqlite-core/query-builders/insert.d.ts:168

### run

run: (
placeholderValues?: Record<string, unknown>,
) => Result<TResultType, TRunResult>

- Defined in node_modules/.pnpm/drizzle-orm@0.44.6_@cloudflare+workers-types@4.20251014.0_@opentelemetry+api@1.9.0_@typ_31a6f5ca8f102af87864dd251ed08d88/node_modules/drizzle-orm/sqlite-core/query-builders/insert.d.ts:166

### values

values: (
placeholderValues?: Record<string, unknown>,
) => Result<
TResultType,
TReturning extends undefined
? DrizzleTypeError<".values() cannot be used without .returning()">
: any[][],
>

- Defined in node_modules/.pnpm/drizzle-orm@0.44.6_@cloudflare+workers-types@4.20251014.0_@opentelemetry+api@1.9.0_@typ_31a6f5ca8f102af87864dd251ed08d88/node_modules/drizzle-orm/sqlite-core/query-builders/insert.d.ts:169

### `Static` `Readonly`[entityKind]

"[entityKind]": string

- Defined in node_modules/.pnpm/drizzle-orm@0.44.6_@cloudflare+workers-types@4.20251014.0_@opentelemetry+api@1.9.0_@typ_31a6f5ca8f102af87864dd251ed08d88/node_modules/drizzle-orm/sqlite-core/query-builders/insert.d.ts:84

## Methods

### $dynamic

- $dynamic(): SQLiteInsertDynamic<
  SQLiteInsertBase<
  TTable,
  TResultType,
  TRunResult,
  TReturning,
  TDynamic,
  TExcludedMethods,
  >,
  >

  #### Returns SQLiteInsertDynamic<
  SQLiteInsertBase<
  TTable,
  TResultType,
  TRunResult,
  TReturning,
  TDynamic,
  TExcludedMethods,
  >,
  >

  - Defined in node_modules/.pnpm/drizzle-orm@0.44.6_@cloudflare+workers-types@4.20251014.0_@opentelemetry+api@1.9.0_@typ_31a6f5ca8f102af87864dd251ed08d88/node_modules/drizzle-orm/sqlite-core/query-builders/insert.d.ts:171

### catch

- catch<TResult = never>(
  onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null,
  ): Promise<
  (TReturning extends undefined ? TRunResult : TReturning[])
  | TResult,
  >

  Attaches a callback for only the rejection of the Promise.

  #### Type Parameters

  - TResult = never

  #### Parameters

  - `Optional` onRejected: ((reason: any) => TResult | PromiseLike<TResult>) | null

  #### Returns Promise<(TReturning extends undefined ? TRunResult : TReturning[]) | TResult>

  A Promise for the completion of the callback.

  Inherited from QueryPromise.catch

  - Defined in node_modules/.pnpm/drizzle-orm@0.44.6_@cloudflare+workers-types@4.20251014.0_@opentelemetry+api@1.9.0_@typ_31a6f5ca8f102af87864dd251ed08d88/node_modules/drizzle-orm/query-promise.d.ts:5

### execute

- execute(): Promise<
  SQLiteInsertExecute<
  SQLiteInsertBase<
  TTable,
  TResultType,
  TRunResult,
  TReturning,
  TDynamic,
  TExcludedMethods,
  >,
  >,
  >

  #### Returns Promise<
  SQLiteInsertExecute<
  SQLiteInsertBase<
  TTable,
  TResultType,
  TRunResult,
  TReturning,
  TDynamic,
  TExcludedMethods,
  >,
  >,
  >

  Inherited from QueryPromise.execute

  - Defined in node_modules/.pnpm/drizzle-orm@0.44.6_@cloudflare+workers-types@4.20251014.0_@opentelemetry+api@1.9.0_@typ_31a6f5ca8f102af87864dd251ed08d88/node_modules/drizzle-orm/sqlite-core/query-builders/insert.d.ts:170

### finally

- finally(
  onFinally?: (() => void) | null,
  ): Promise<TReturning extends undefined ? TRunResult : TReturning[]>

  Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The resolved value cannot be modified from the callback.

  #### Parameters

  - `Optional` onFinally: (() => void) | null

  #### Returns Promise<TReturning extends undefined ? TRunResult : TReturning[]>

  A Promise for the completion of the callback.

  Inherited from QueryPromise.finally

  - Defined in node_modules/.pnpm/drizzle-orm@0.44.6_@cloudflare+workers-types@4.20251014.0_@opentelemetry+api@1.9.0_@typ_31a6f5ca8f102af87864dd251ed08d88/node_modules/drizzle-orm/query-promise.d.ts:6

### getSQL

- getSQL(): SQL

  #### Returns SQL

  Inherited from SQLWrapper.getSQL

  - Defined in node_modules/.pnpm/drizzle-orm@0.44.6_@cloudflare+workers-types@4.20251014.0_@opentelemetry+api@1.9.0_@typ_31a6f5ca8f102af87864dd251ed08d88/node_modules/drizzle-orm/sql/sql.d.ts:50

### onConflictDoNothing

- onConflictDoNothing(
  config?: { target?: IndexColumn | IndexColumn[]; where?: SQL<unknown> },
  ): this

  Adds an `on conflict do nothing` clause to the query.

  Calling this method simply avoids inserting a row as its alternative action.

  See docs: https://orm.drizzle.team/docs/insert#on-conflict-do-nothing

  #### Parameters

  - `Optional` config: { target?: IndexColumn | IndexColumn[]; where?: SQL<unknown> }

    The `target` and `where` clauses.

  #### Returns this

  #### Example

      // Insert one row and cancel the insert if there's a conflict
      await db.insert(cars)
        .values({ id: 1, brand: 'BMW' })
        .onConflictDoNothing();

      // Explicitly specify conflict target
      await db.insert(cars)
        .values({ id: 1, brand: 'BMW' })
        .onConflictDoNothing({ target: cars.id });

  - Defined in node_modules/.pnpm/drizzle-orm@0.44.6_@cloudflare+workers-types@4.20251014.0_@opentelemetry+api@1.9.0_@typ_31a6f5ca8f102af87864dd251ed08d88/node_modules/drizzle-orm/sqlite-core/query-builders/insert.d.ts:130

### onConflictDoUpdate

- onConflictDoUpdate(
  config: SQLiteInsertOnConflictDoUpdateConfig<
  SQLiteInsertBase<
  TTable,
  TResultType,
  TRunResult,
  TReturning,
  TDynamic,
  TExcludedMethods,
  >,
  >,
  ): this

  Adds an `on conflict do update` clause to the query.

  Calling this method will update the existing row that conflicts with the row proposed for insertion as its alternative action.

  See docs: https://orm.drizzle.team/docs/insert#upserts-and-conflicts

  #### Parameters

  - config: SQLiteInsertOnConflictDoUpdateConfig<
    SQLiteInsertBase<
    TTable,
    TResultType,
    TRunResult,
    TReturning,
    TDynamic,
    TExcludedMethods,
    >,
    >

    The `target`, `set` and `where` clauses.

  #### Returns this

  #### Example

      // Update the row if there's a conflict
      await db.insert(cars)
        .values({ id: 1, brand: 'BMW' })
        .onConflictDoUpdate({
          target: cars.id,
          set: { brand: 'Porsche' }
        });

      // Upsert with 'where' clause
      await db.insert(cars)
        .values({ id: 1, brand: 'BMW' })
        .onConflictDoUpdate({
          target: cars.id,
          set: { brand: 'newBMW' },
          where: sql`${cars.createdAt} > '2023-01-01'::date`,
        });

  - Defined in node_modules/.pnpm/drizzle-orm@0.44.6_@cloudflare+workers-types@4.20251014.0_@opentelemetry+api@1.9.0_@typ_31a6f5ca8f102af87864dd251ed08d88/node_modules/drizzle-orm/sqlite-core/query-builders/insert.d.ts:163

### prepare

- prepare(): SQLiteInsertPrepare<
  SQLiteInsertBase<
  TTable,
  TResultType,
  TRunResult,
  TReturning,
  TDynamic,
  TExcludedMethods,
  >,
  >

  #### Returns SQLiteInsertPrepare<
  SQLiteInsertBase<
  TTable,
  TResultType,
  TRunResult,
  TReturning,
  TDynamic,
  TExcludedMethods,
  >,
  >

  - Defined in node_modules/.pnpm/drizzle-orm@0.44.6_@cloudflare+workers-types@4.20251014.0_@opentelemetry+api@1.9.0_@typ_31a6f5ca8f102af87864dd251ed08d88/node_modules/drizzle-orm/sqlite-core/query-builders/insert.d.ts:165

### returning

- returning(): SQLiteInsertWithout<
  SQLiteInsertBase<
  TTable,
  TResultType,
  TRunResult,
  TTable["$inferSelect"],
  TDynamic,
  TExcludedMethods,
  >,
  TDynamic,
  >

  Adds a `returning` clause to the query.

  Calling this method will return the specified fields of the inserted rows. If no fields are specified, all fields will be returned.

  See docs: https://orm.drizzle.team/docs/insert#insert-returning

  #### Returns SQLiteInsertWithout<
  SQLiteInsertBase<
  TTable,
  TResultType,
  TRunResult,
  TTable["$inferSelect"],
  TDynamic,
  TExcludedMethods,
  >,
  TDynamic,
  >

  #### Example

      // Insert one row and return all fields
      const insertedCar: Car[] = await db.insert(cars)
        .values({ brand: 'BMW' })
        .returning();

      // Insert one row and return only the id
      const insertedCarId: { id: number }[] = await db.insert(cars)
        .values({ brand: 'BMW' })
        .returning({ id: cars.id });

  - Defined in node_modules/.pnpm/drizzle-orm@0.44.6_@cloudflare+workers-types@4.20251014.0_@opentelemetry+api@1.9.0_@typ_31a6f5ca8f102af87864dd251ed08d88/node_modules/drizzle-orm/sqlite-core/query-builders/insert.d.ts:106
- returning<TSelectedFields extends SelectedFieldsFlat>(
  fields: TSelectedFields,
  ): SQLiteInsertWithout<
  SQLiteInsertBase<
  TTable,
  TResultType,
  TRunResult,
  {
  [K in string
  | number
  | symbol]: {
  [Key in string | number | symbol]: SelectResultField<
  TSelectedFields[Key],
  true,
  >
  }[K]
  },
  TDynamic,
  TExcludedMethods,
  >,
  TDynamic,
  "returning",
  >

  Adds a `returning` clause to the query.

  Calling this method will return the specified fields of the inserted rows. If no fields are specified, all fields will be returned.

  See docs: https://orm.drizzle.team/docs/insert#insert-returning

  #### Type Parameters

  - TSelectedFields extends SelectedFieldsFlat

  #### Parameters

  - fields: TSelectedFields

  #### Returns SQLiteInsertWithout<
  SQLiteInsertBase<
  TTable,
  TResultType,
  TRunResult,
  {
  [K in string
  | number
  | symbol]: {
  [Key in string | number | symbol]: SelectResultField<
  TSelectedFields[Key],
  true,
  >
  }[K]
  },
  TDynamic,
  TExcludedMethods,
  >,
  TDynamic,
  "returning",
  >

  #### Example

      // Insert one row and return all fields
      const insertedCar: Car[] = await db.insert(cars)
        .values({ brand: 'BMW' })
        .returning();

      // Insert one row and return only the id
      const insertedCarId: { id: number }[] = await db.insert(cars)
        .values({ brand: 'BMW' })
        .returning({ id: cars.id });

  - Defined in node_modules/.pnpm/drizzle-orm@0.44.6_@cloudflare+workers-types@4.20251014.0_@opentelemetry+api@1.9.0_@typ_31a6f5ca8f102af87864dd251ed08d88/node_modules/drizzle-orm/sqlite-core/query-builders/insert.d.ts:107

### `Optional` shouldOmitSQLParens

- shouldOmitSQLParens?(): boolean

  #### Returns boolean

  Inherited from SQLWrapper.shouldOmitSQLParens

  - Defined in node_modules/.pnpm/drizzle-orm@0.44.6_@cloudflare+workers-types@4.20251014.0_@opentelemetry+api@1.9.0_@typ_31a6f5ca8f102af87864dd251ed08d88/node_modules/drizzle-orm/sql/sql.d.ts:51

### then

- then<
  TResult1 = TReturning extends undefined ? TRunResult : TReturning[],
  TResult2 = never,
  >(
  onFulfilled?:
  | (
  (
  value: TReturning extends undefined ? TRunResult : TReturning[],
  ) => TResult1 | PromiseLike<TResult1>
  )
  | null,
  onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null,
  ): Promise<TResult1 | TResult2>

  Attaches callbacks for the resolution and/or rejection of the Promise.

  #### Type Parameters

  - TResult1 = TReturning extends undefined ? TRunResult : TReturning[]
  - TResult2 = never

  #### Parameters

  - `Optional` onFulfilled:
    | (
    (
    value: TReturning extends undefined ? TRunResult : TReturning[],
    ) => TResult1 | PromiseLike<TResult1>
    )
    | null
  - `Optional` onRejected: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null

  #### Returns Promise<TResult1 | TResult2>

  A Promise for the completion of which ever callback is executed.

  Inherited from QueryPromise.then

  - Defined in node_modules/.pnpm/drizzle-orm@0.44.6_@cloudflare+workers-types@4.20251014.0_@opentelemetry+api@1.9.0_@typ_31a6f5ca8f102af87864dd251ed08d88/node_modules/drizzle-orm/query-promise.d.ts:7

### toSQL

- toSQL(): Query

  #### Returns Query

  - Defined in node_modules/.pnpm/drizzle-orm@0.44.6_@cloudflare+workers-types@4.20251014.0_@opentelemetry+api@1.9.0_@typ_31a6f5ca8f102af87864dd251ed08d88/node_modules/drizzle-orm/sqlite-core/query-builders/insert.d.ts:164