new Database(databasePath, bufferManagerSize, enableCompression, readOnly, maxDBSize)
Initialize a new Database object. Note that the initialization is done
lazily, so the database file is not opened until the first query is
executed. To initialize the database immediately, call the `init()`
function on the returned object.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
databasePath |
String | path to the database file. If the path is not specified, or empty, or equal to `:memory:`, the database will be created in memory. | |
bufferManagerSize |
Number | 0 | size of the buffer manager in bytes. |
enableCompression |
Boolean | true | whether to enable compression. |
readOnly |
Boolean | false | if true, database will be opened in read-only mode. |
maxDBSize |
Number | 0 | maximum size of the database file in bytes. Note that this is introduced temporarily for now to get around with the default 8TB mmap address space limit some environment. |
- Source:
Methods
(async) _getDatabase() → {KuzuNative.NodeDatabase}
Internal function to get the underlying native database object.
- Source:
Throws:
-
if the database is closed.
- Type
- Error
Returns:
the underlying native database.
- Type
- KuzuNative.NodeDatabase
_getDatabaseSync() → {KuzuNative.NodeDatabase}
Internal function to get the underlying native database object synchronously.
- Source:
Throws:
-
if the database is closed.
- Type
- Error
Returns:
the underlying native database.
- Type
- KuzuNative.NodeDatabase
(async) close()
Close the database.
- Source:
closeSync()
Close the database synchronously.
- Source:
Throws:
-
if there is an ongoing asynchronous initialization.
- Type
- Error
(async) init()
Initialize the database. Calling this function is optional, as the
database is initialized automatically when the first query is executed.
- Source:
initSync()
Initialize the database synchronously. Calling this function is optional, as the
database is initialized automatically when the first query is executed. This function
may block the main thread, so use it with caution.
- Source:
(static) getStorageVersion() → {Number}
Get the storage version of the library.
- Source:
Returns:
the storage version of the library.
- Type
- Number
(static) getVersion() → {String}
Get the version of the library.
- Source:
Returns:
the version of the library.
- Type
- String