| 1 | [vectordb](../README.md) / [Exports](../modules.md) / Connection |
| 2 | |
| 3 | # Interface: Connection |
| 4 | |
| 5 | A LanceDB Connection that allows you to open tables and create new ones. |
| 6 | |
| 7 | Connection could be local against filesystem or remote against a server. |
| 8 | |
| 9 | ## Implemented by |
| 10 | |
| 11 | - [`LocalConnection`](../classes/LocalConnection.md) |
| 12 | |
| 13 | ## Table of contents |
| 14 | |
| 15 | ### Properties |
| 16 | |
| 17 | - [uri](Connection.md#uri) |
| 18 | |
| 19 | ### Methods |
| 20 | |
| 21 | - [createTable](Connection.md#createtable) |
| 22 | - [dropTable](Connection.md#droptable) |
| 23 | - [openTable](Connection.md#opentable) |
| 24 | - [tableNames](Connection.md#tablenames) |
| 25 | |
| 26 | ## Properties |
| 27 | |
| 28 | ### uri |
| 29 | |
| 30 | • **uri**: `string` |
| 31 | |
| 32 | #### Defined in |
| 33 | |
| 34 | [index.ts:183](https://github.com/lancedb/lancedb/blob/c89d5e6/node/src/index.ts#L183) |
| 35 | |
| 36 | ## Methods |
| 37 | |
| 38 | ### createTable |
| 39 | |
| 40 | ▸ **createTable**\<`T`\>(`«destructured»`): `Promise`\<[`Table`](Table.md)\<`T`\>\> |
| 41 | |
| 42 | Creates a new Table, optionally initializing it with new data. |
| 43 | |
| 44 | #### Type parameters |
| 45 | |
| 46 | | Name | |
| 47 | | :------ | |
| 48 | | `T` | |
| 49 | |
| 50 | #### Parameters |
| 51 | |
| 52 | | Name | Type | |
| 53 | | :------ | :------ | |
| 54 | | `«destructured»` | [`CreateTableOptions`](CreateTableOptions.md)\<`T`\> | |
| 55 | |
| 56 | #### Returns |
| 57 | |
| 58 | `Promise`\<[`Table`](Table.md)\<`T`\>\> |
| 59 | |
| 60 | #### Defined in |
| 61 | |
| 62 | [index.ts:207](https://github.com/lancedb/lancedb/blob/c89d5e6/node/src/index.ts#L207) |
| 63 | |
| 64 | ▸ **createTable**(`name`, `data`): `Promise`\<[`Table`](Table.md)\<`number`[]\>\> |
| 65 | |
| 66 | Creates a new Table and initialize it with new data. |
| 67 | |
| 68 | #### Parameters |
| 69 | |
| 70 | | Name | Type | Description | |
| 71 | | :------ | :------ | :------ | |
| 72 | | `name` | `string` | The name of the table. | |
| 73 | | `data` | `Record`\<`string`, `unknown`\>[] | Non-empty Array of Records to be inserted into the table | |
| 74 | |
| 75 | #### Returns |
| 76 | |
| 77 | `Promise`\<[`Table`](Table.md)\<`number`[]\>\> |
| 78 | |
| 79 | #### Defined in |
| 80 | |
| 81 | [index.ts:221](https://github.com/lancedb/lancedb/blob/c89d5e6/node/src/index.ts#L221) |
| 82 | |
| 83 | ▸ **createTable**(`name`, `data`, `options`): `Promise`\<[`Table`](Table.md)\<`number`[]\>\> |
| 84 | |
| 85 | Creates a new Table and initialize it with new data. |
| 86 | |
| 87 | #### Parameters |
| 88 | |
| 89 | | Name | Type | Description | |
| 90 | | :------ | :------ | :------ | |
| 91 | | `name` | `string` | The name of the table. | |
| 92 | | `data` | `Record`\<`string`, `unknown`\>[] | Non-empty Array of Records to be inserted into the table | |
| 93 | | `options` | [`WriteOptions`](WriteOptions.md) | The write options to use when creating the table. | |
| 94 | |
| 95 | #### Returns |
| 96 | |
| 97 | `Promise`\<[`Table`](Table.md)\<`number`[]\>\> |
| 98 | |
| 99 | #### Defined in |
| 100 | |
| 101 | [index.ts:233](https://github.com/lancedb/lancedb/blob/c89d5e6/node/src/index.ts#L233) |
| 102 | |
| 103 | ▸ **createTable**\<`T`\>(`name`, `data`, `embeddings`): `Promise`\<[`Table`](Table.md)\<`T`\>\> |
| 104 | |
| 105 | Creates a new Table and initialize it with new data. |
| 106 | |
| 107 | #### Type parameters |
| 108 | |
| 109 | | Name | |
| 110 | | :------ | |
| 111 | | `T` | |
| 112 | |
| 113 | #### Parameters |
| 114 | |
| 115 | | Name | Type | Description | |
| 116 | | :------ | :------ | :------ | |
| 117 | | `name` | `string` | The name of the table. | |
| 118 | | `data` | `Record`\<`string`, `unknown`\>[] | Non-empty Array of Records to be inserted into the table | |
| 119 | | `embeddings` | [`EmbeddingFunction`](EmbeddingFunction.md)\<`T`\> | An embedding function to use on this table | |
| 120 | |
| 121 | #### Returns |
| 122 | |
| 123 | `Promise`\<[`Table`](Table.md)\<`T`\>\> |
| 124 | |
| 125 | #### Defined in |
| 126 | |
| 127 | [index.ts:246](https://github.com/lancedb/lancedb/blob/c89d5e6/node/src/index.ts#L246) |
| 128 | |
| 129 | ▸ **createTable**\<`T`\>(`name`, `data`, `embeddings`, `options`): `Promise`\<[`Table`](Table.md)\<`T`\>\> |
| 130 | |
| 131 | Creates a new Table and initialize it with new data. |
| 132 | |
| 133 | #### Type parameters |
| 134 | |
| 135 | | Name | |
| 136 | | :------ | |
| 137 | | `T` | |
| 138 | |
| 139 | #### Parameters |
| 140 | |
| 141 | | Name | Type | Description | |
| 142 | | :------ | :------ | :------ | |
| 143 | | `name` | `string` | The name of the table. | |
| 144 | | `data` | `Record`\<`string`, `unknown`\>[] | Non-empty Array of Records to be inserted into the table | |
| 145 | | `embeddings` | [`EmbeddingFunction`](EmbeddingFunction.md)\<`T`\> | An embedding function to use on this table | |
| 146 | | `options` | [`WriteOptions`](WriteOptions.md) | The write options to use when creating the table. | |
| 147 | |
| 148 | #### Returns |
| 149 | |
| 150 | `Promise`\<[`Table`](Table.md)\<`T`\>\> |
| 151 | |
| 152 | #### Defined in |
| 153 | |
| 154 | [index.ts:259](https://github.com/lancedb/lancedb/blob/c89d5e6/node/src/index.ts#L259) |
| 155 | |
| 156 | ___ |
| 157 | |
| 158 | ### dropTable |
| 159 | |
| 160 | ▸ **dropTable**(`name`): `Promise`\<`void`\> |
| 161 | |
| 162 | Drop an existing table. |
| 163 | |
| 164 | #### Parameters |
| 165 | |
| 166 | | Name | Type | Description | |
| 167 | | :------ | :------ | :------ | |
| 168 | | `name` | `string` | The name of the table to drop. | |
| 169 | |
| 170 | #### Returns |
| 171 | |
| 172 | `Promise`\<`void`\> |
| 173 | |
| 174 | #### Defined in |
| 175 | |
| 176 | [index.ts:270](https://github.com/lancedb/lancedb/blob/c89d5e6/node/src/index.ts#L270) |
| 177 | |
| 178 | ___ |
| 179 | |
| 180 | ### openTable |
| 181 | |
| 182 | ▸ **openTable**\<`T`\>(`name`, `embeddings?`): `Promise`\<[`Table`](Table.md)\<`T`\>\> |
| 183 | |
| 184 | Open a table in the database. |
| 185 | |
| 186 | #### Type parameters |
| 187 | |
| 188 | | Name | |
| 189 | | :------ | |
| 190 | | `T` | |
| 191 | |
| 192 | #### Parameters |
| 193 | |
| 194 | | Name | Type | Description | |
| 195 | | :------ | :------ | :------ | |
| 196 | | `name` | `string` | The name of the table. | |
| 197 | | `embeddings?` | [`EmbeddingFunction`](EmbeddingFunction.md)\<`T`\> | An embedding function to use on this table | |
| 198 | |
| 199 | #### Returns |
| 200 | |
| 201 | `Promise`\<[`Table`](Table.md)\<`T`\>\> |
| 202 | |
| 203 | #### Defined in |
| 204 | |
| 205 | [index.ts:193](https://github.com/lancedb/lancedb/blob/c89d5e6/node/src/index.ts#L193) |
| 206 | |
| 207 | ___ |
| 208 | |
| 209 | ### tableNames |
| 210 | |
| 211 | ▸ **tableNames**(): `Promise`\<`string`[]\> |
| 212 | |
| 213 | #### Returns |
| 214 | |
| 215 | `Promise`\<`string`[]\> |
| 216 | |
| 217 | #### Defined in |
| 218 | |
| 219 | [index.ts:185](https://github.com/lancedb/lancedb/blob/c89d5e6/node/src/index.ts#L185) |