Meta tags:
description= Lightweight WASM Postgres;
Headings (most frequently used words):
pglite, tools, about, docs, extensions, reference, pgdump, framework, hooks, options, returns, caveats, example,
Text of the page (most frequently used words):
the (23), #pglite (17), dump (11), await (9), pg_dump (9), sql (7), file (6), tools (6), electric (5), exec (5), create (5), const (5), for (5), set (4), search_path (4), search (4), path (4), pgdump (4), can (4), postgres (4), this (4), that (4), docs (4), and (3), page (3), restoredpg (3), after (3), database (3), text (3), used (3), test (3), name (3), you (3), output (3), are (3), about (3), prepopulated (2), socket (2), initialsearchpath (2), initial (2), dumpcontent (2), restore (2), using (2), query (2), restored (2), insert (2), table (2), from (2), import (2), same (2), use (2), tmp (2), out (2), inserts (2), arguments (2), more (2), will (2), running (2), install (2), npm (2), with (2), extensions (2), support (2), sync (2), repl (2), navigation (2), dual, licensed, under, postgresql, license, apache, next, previous, pager, optional, importing, back, one, new, get, rows, show, string, pg1, store, current, into, values, serial, primary, key, some, data, typescript, example, restoring, might, want, caveats, object, containing, returns, user, hard, coded, always, written, virtual, system, concurrency, level, multithreading, isn, supported, format, ensures, simply, passing, there, number, automatically, added, end, command, these, write, defaults, filename, array, pass, see, details, args, instance, options, note, execute, each, since, single, connection, any, prepared, statements, have, made, before, affected, deallocate, all, tool, dumping, wasm, build, browser, other, javascript, environments, read, bash, selection, working, databases, including, debugging, benchmarks, examples, reference, extension, development, catalog, upgrade, locale, package, orms, builders, component, multi, tab, worker, bundler, vue, react, framework, hooks, filesystems, live, queries, api, getting, started, videos, what, sidebar, return, top, menu, github, home, main, skip, content,
Text of the page (random words):
pglite tools pglite skip to content search k main navigation home about docs repl electric github npm menu return to top sidebar navigation about what is pglite videos docs getting started pglite api live queries filesystems framework hooks react vue bundler support multi tab worker repl component orms query builders sync using postgres sync pglite socket pglite tools package pgdump prepopulated fs locale support upgrade path extensions extensions catalog extension development reference examples benchmarks debugging on this page pglite tools a selection of tools for working with pglite databases including pg_dump install with bash npm install electric sql pglite tools pgdump pg_dump is a tool for dumping a pglite database to a sql file this is a wasm build of pg_dump that can be used in a browser or other javascript environments you can read more about pg_dump in the postgres docs note pg_dump will execute deallocate all after each dump since this is running on the same single connection any prepared statements that you have made before running pg_dump will be affected options pg a pglite instance args an array of arguments to pass to pg_dump see pg_dump docs for more details filename the name of the file to write the dump to defaults to dump sql there are a number of arguments that are automatically added to the end of the command these are inserts use inserts format for the output this ensures that the dump can be restored by simply passing the output to pg exec j 1 concurrency level set to 1 as multithreading isn t supported f tmp out sql the output file is always written to tmp out sql in the virtual file system u postgres use the postgres user is hard coded returns a file object containing the dump caveats after restoring a dump you might want to set the same search path as the initial db example typescript import pglite from electric sql pglite import pgdump from electric sql pglite tools pg_dump const pg await pglite create create a table and insert some data await pg exec create table test id serial primary key name text await pg exec insert into test name values test store the current search path so it can be used in the restored db const initialsearchpath await pg1 query search_path string show search_path rows 0 search_path dump the database to a file const dump await pgdump pg get the dump text used for restore const dumpcontent await dump text create a new database const restoredpg await pglite create and restore it using the dump await restoredpg exec dumpcontent optional after importing set search path back to the initial one await restoredpg exec set search_path to initialsearchpath pager previous page pglite socket next page prepopulated fs dual licensed under apache 2 0 and the postgresql license electric
|