Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aws-sdk/client-rds-data

Package Overview
Dependencies
Maintainers
5
Versions
420
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-sdk/client-rds-data

AWS SDK for JavaScript Rds Data Client for Node.js, Browser and React Native

  • 3.699.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
240K
increased by7.09%
Maintainers
5
Weekly downloads
 
Created

What is @aws-sdk/client-rds-data?

@aws-sdk/client-rds-data is an AWS SDK for JavaScript package that allows you to interact with Amazon RDS Data Service. This service enables you to run SQL statements on Amazon Aurora Serverless clusters through a secure HTTP endpoint without managing database connections.

What are @aws-sdk/client-rds-data's main functionalities?

Execute SQL Statements

This feature allows you to execute SQL statements on your Amazon Aurora Serverless cluster. The code sample demonstrates how to set up the client, define the parameters, and execute a SQL statement to retrieve data from a table.

const { RDSDataClient, ExecuteStatementCommand } = require('@aws-sdk/client-rds-data');

const client = new RDSDataClient({ region: 'us-west-2' });

const params = {
  resourceArn: 'arn:aws:rds:us-west-2:123456789012:cluster:my-aurora-cluster',
  secretArn: 'arn:aws:secretsmanager:us-west-2:123456789012:secret:my-secret',
  sql: 'SELECT * FROM my_table',
  database: 'my_database'
};

const run = async () => {
  try {
    const data = await client.send(new ExecuteStatementCommand(params));
    console.log(data);
  } catch (err) {
    console.error(err);
  }
};

run();

Batch Execute SQL Statements

This feature allows you to execute a batch of SQL statements in a single request. The code sample demonstrates how to set up the client, define the parameters, and execute multiple SQL insert statements in a batch.

const { RDSDataClient, BatchExecuteStatementCommand } = require('@aws-sdk/client-rds-data');

const client = new RDSDataClient({ region: 'us-west-2' });

const params = {
  resourceArn: 'arn:aws:rds:us-west-2:123456789012:cluster:my-aurora-cluster',
  secretArn: 'arn:aws:secretsmanager:us-west-2:123456789012:secret:my-secret',
  sql: 'INSERT INTO my_table (id, name) VALUES (:id, :name)',
  database: 'my_database',
  parameterSets: [
    [
      { name: 'id', value: { longValue: 1 } },
      { name: 'name', value: { stringValue: 'John' } }
    ],
    [
      { name: 'id', value: { longValue: 2 } },
      { name: 'name', value: { stringValue: 'Jane' } }
    ]
  ]
};

const run = async () => {
  try {
    const data = await client.send(new BatchExecuteStatementCommand(params));
    console.log(data);
  } catch (err) {
    console.error(err);
  }
};

run();

Begin Transaction

This feature allows you to begin a new transaction. The code sample demonstrates how to set up the client, define the parameters, and begin a transaction on your Amazon Aurora Serverless cluster.

const { RDSDataClient, BeginTransactionCommand } = require('@aws-sdk/client-rds-data');

const client = new RDSDataClient({ region: 'us-west-2' });

const params = {
  resourceArn: 'arn:aws:rds:us-west-2:123456789012:cluster:my-aurora-cluster',
  secretArn: 'arn:aws:secretsmanager:us-west-2:123456789012:secret:my-secret',
  database: 'my_database'
};

const run = async () => {
  try {
    const data = await client.send(new BeginTransactionCommand(params));
    console.log(data);
  } catch (err) {
    console.error(err);
  }
};

run();

Commit Transaction

This feature allows you to commit a transaction. The code sample demonstrates how to set up the client, define the parameters, and commit a transaction on your Amazon Aurora Serverless cluster.

const { RDSDataClient, CommitTransactionCommand } = require('@aws-sdk/client-rds-data');

const client = new RDSDataClient({ region: 'us-west-2' });

const params = {
  resourceArn: 'arn:aws:rds:us-west-2:123456789012:cluster:my-aurora-cluster',
  secretArn: 'arn:aws:secretsmanager:us-west-2:123456789012:secret:my-secret',
  transactionId: 'your-transaction-id'
};

const run = async () => {
  try {
    const data = await client.send(new CommitTransactionCommand(params));
    console.log(data);
  } catch (err) {
    console.error(err);
  }
};

run();

Rollback Transaction

This feature allows you to roll back a transaction. The code sample demonstrates how to set up the client, define the parameters, and roll back a transaction on your Amazon Aurora Serverless cluster.

const { RDSDataClient, RollbackTransactionCommand } = require('@aws-sdk/client-rds-data');

const client = new RDSDataClient({ region: 'us-west-2' });

const params = {
  resourceArn: 'arn:aws:rds:us-west-2:123456789012:cluster:my-aurora-cluster',
  secretArn: 'arn:aws:secretsmanager:us-west-2:123456789012:secret:my-secret',
  transactionId: 'your-transaction-id'
};

const run = async () => {
  try {
    const data = await client.send(new RollbackTransactionCommand(params));
    console.log(data);
  } catch (err) {
    console.error(err);
  }
};

run();

Other packages similar to @aws-sdk/client-rds-data

FAQs

Package last updated on 22 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc