# dm-driver-aurora

> [![Build Status](https://github.com/theBenForce/data-migration/workflows/Release/badge.svg?branch=master)](https://github.com/theBenForce/data-migration/actions) [![NPM Package](https://img.shields.io/npm/v/dm-driver-aurora)](https://www.npmjs.com/package

Latest version **1.10.0** (published 2021-01-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install dm-driver-aurora
pnpm add dm-driver-aurora
yarn add dm-driver-aurora
bun add dm-driver-aurora
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.10.0 |
| Published | 2021-01-04 |
| First published | 2020-03-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 24.2 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Maintainers | benforce |

## Links

- npm: https://www.npmjs.com/package/dm-driver-aurora
- Repository: https://github.com/theBenForce/data-migration
- Homepage: https://data-migration.js.org/plugins/drivers/aurora-rds
- Issues: https://github.com/theBenForce/data-migration/issues
- npm.io page: https://npm.io/package/dm-driver-aurora

## Dependencies (3)

- [rxjs](https://npm.io/package/rxjs.md) ^6.5.5
- [aws-sdk](https://npm.io/package/aws-sdk.md) ^2.655.0
- [data-migration](https://npm.io/package/data-migration.md) ^2.17.0

## Recent versions

- 1.10.0 (latest) — 2021-01-04
- 1.9.0 — 2020-10-30
- 1.8.9 — 2020-10-30
- 1.8.8 — 2020-10-30
- 1.8.7 — 2020-07-07
- 1.8.6 — 2020-07-07
- 1.8.5 — 2020-07-07
- 1.8.4 — 2020-07-07
- 1.8.3 — 2020-07-07
- 1.8.2 — 2020-06-25
- 1.8.1 — 2020-06-24
- 1.8.0 — 2020-06-17
- 1.7.3 — 2020-06-05
- 1.7.2 — 2020-06-05
- 1.7.1 — 2020-06-05
- … 9 more at https://npm.io/package/dm-driver-aurora/versions

## README

# Welcome to dm-driver-aurora 👋

[![Build Status](https://github.com/theBenForce/data-migration/workflows/Release/badge.svg?branch=master)](https://github.com/theBenForce/data-migration/actions)
[![NPM Package](https://img.shields.io/npm/v/dm-driver-aurora)](https://www.npmjs.com/package/dm-driver-aurora)
[![Maintainability](https://api.codeclimate.com/v1/badges/89a0c1976c9b89979635/maintainability)](https://codeclimate.com/github/theBenForce/data-migration/maintainability)
[![Documentation](https://img.shields.io/badge/documentation-view-blue)](https://data-migration.js.org/)
[![Downloads/week](https://img.shields.io/npm/dw/dm-driver-aurora.svg)](https://npmjs.org/package/dm-driver-aurora)
[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)

> A [Data Migration](https://www.npmjs.com/package/data-migration) driver to run queries on an Aurora RDS instance.

## Configuration

### Parameters

The Aurora RDS driver accepts the following parameters as part of its configuration:

| Name           | Type   | Required | Description                                                      |
| -------------- | ------ | -------- | ---------------------------------------------------------------- |
| region         | string | Yes      | The AWS Region where this table exists                           |
| resourceArn    | string | Yes      | ARN of the Aruora RDS cluster                                    |
| secretArn      | string | Yes      | ARN of the secret manager secret to use for database credentials |
| profile        | string | No       | Name of the AWS profile to use                                   |
| databaseSchema | string | No       | The database schema to connect to by default                     |

### Example

```javascript
const CloudFormationProcessor = require("dm-processor-cf");

module.exports = {
  defaultStage: "prod",
  migrationDirectory: "migrations",
  stages: {
    prod: {
      defaultParams: {
        region: "us-east-1",
        stack: "some-stack-name",
      },
      drivers: {
        auroraDriver: {
          driver: require("dm-driver-aurora"),
          params: {
            databaseSchema: "some-schema",
            resourceArn: {
              processor: CloudFormationProcessor,
              params: {
                output: "AuroraArn",
              },
            },
            secretArn: {
              processor: CloudFormationProcessor,
              params: {
                output: "AuroraSecretArn",
              },
            },
          },
        },
      },
    },
  },
};
```

## Methods

### query

> Executes a query against the database, returning a rxjs `Observable`

#### Arguments

| Name       | Description                                                                   |
| ---------- | ----------------------------------------------------------------------------- |
| query      | The query string to be executed                                               |
| parameters | An array of `AWS.RDSDataService.SqlParameter`s that will be used in the query |
| options    | A `QueryOptions` object                                                       |

#### Example

```typescript
import { toArray } from "rxjs/operators";
import { AuroraRdsDriver } from "dm-driver-aurora";

export default {
  async up(context: ScriptContext, log: Logger) {
    const aurora = await context.getDriver<AuroraRdsDriver>("auroraDriver");
    const someTableResults = await aurora
      .query<SomeDataType>(`SELECT * FROM some_table`)
      .pipe(toArray())
      .toPromise();
  },
};
```

---
_Source: https://npm.io/package/dm-driver-aurora · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
