getMetadata
Understanding the getMetadata method
getMetadata(connection: Connection): Promise<Table[]>
Description: Fetches the metadata (tables and columns) from the database based on the provided connection details
Parameters:
connection
(Connection): AConnection
object containing database connection details.
Returns:
A
Promise
that resolves to an array ofTable
objects or rejects with anSQLError
.
Example:
client.getMetadata({
id: "1",
name: "Chinook",
host: "localhost",
port: 5432,
user: "postgres",
password: "password",
database: "chinook",
type: DatabaseType.POSTGRES
}).then((tables) => {
console.log(tables);
}).catch((error) => {
console.error(error);
});
Last updated