![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
dynamodb-migrations
Advanced tools
This library allows you to manager DynamoDB Migration Files (Which includes your Tables Schema and Seed data) with an simplified template for use in devops.
npm install --save dynamodb-migrations
Usage example
var AWS = require('aws-sdk'),
dm = require("dynamodb-migrations");
/* Note: To configure AWS Credentials refer https://aws.amazon.com/sdk-for-node-js/ */
var dynamodb = {raw: new AWS.DynamoDB() , doc: new AWS.DynamoDB.DocumentClient() };
dm.init(dynamodb, '<myprojectroot>/<migrations>'); /* This method requires multiple dynamodb instances with default Dynamodb client and Dynamodb Document Client. All the other methods depends on this. */
dm.create('sampleTable'); /* Use gulp, grunt or serverless to integrate this with the commandline, modify the created template file with your custom table schema and seed data */
dm.execute('sampleTable', { prefix: 'dev-', suffix: '-sample'}); /* This executes the 'sampleTable' migration. Note: second parameter is optional. With prefix and suffix actual table name e.g dev-<tablename>-sample
Note: For dynamodb local you can initialize the dynamodb variable as follows
var options = { region: 'localhost', endpoint: "http://localhost:8000" },
dynamodb = {raw: new AWS.DynamoDB(options) , doc: new AWS.DynamoDB.DocumentClient(options) };
Note: for the 'init' method, the migration directory path should be an absolute path. Following example shows how to refer the adbolute path
var path = require('path');
var relPath = 'migrations';
var absolutePath = path.dirname(__filename) + '/' + relPath;
Supported methods
init(dynamodb, migrationsDir) To initialize DynamoDB Client Instances to execute queries and to initialize the directory where migration files exists
create(migrationName) To create a new template with migrationName included, which you can modify to include other attributes and seed data. More information on migration template is shown in the following section.
execute(migrationName, tableOptions) To execute a single migration file. This create the tables if they don't exists and runs the seeds defined in the migration file. tableOptions provides, tablePrefix and tableSuffix attributes to be set, if the actual table is different from migration name
executeAll(tableOptions) To execute all the migration files to create tables and run all the seeds
{
"Table": {
"TableName": "TableName",
"KeySchema": [{
"AttributeName": "attr_1",
"KeyType": "HASH"
}, {
"AttributeName": "attr_2",
"KeyType": "RANGE"
}],
"AttributeDefinitions": [{
"AttributeName": "attr_1",
"AttributeType": "S"
}, {
"AttributeName": "attr_2",
"AttributeType": "S"
}],
"LocalSecondaryIndexes": [{
"IndexName": "local_index_1",
"KeySchema": [{
"AttributeName": "attr_1",
"KeyType": "HASH"
}, {
"AttributeName": "attr_2",
"KeyType": "RANGE"
}],
"Projection": {
"NonKeyAttributes": ["attr_1", "attr_2"],
"ProjectionType": "INCLUDE"
}
}],
"GlobalSecondaryIndexes": [{
"IndexName": "global_index_1",
"KeySchema": [{
"AttributeName": "attr_1",
"KeyType": "HASH"
}, {
"AttributeName": "attr_2",
"KeyType": "RANGE"
}],
"Projection": {
"NonKeyAttributes": ["attr_1", "attr_2"],
"ProjectionType": "INCLUDE"
},
"ProvisionedThroughput": {
"ReadCapacityUnits": 1,
"WriteCapacityUnits": 1
}
}],
"ProvisionedThroughput": {
"ReadCapacityUnits": 1,
"WriteCapacityUnits": 1
}
},
"Seeds": [{
"attr_1": "attr_1_value",
"attr_2": "attr_2_value"
}]
}
Before modifying the migration template, refer the Dynamodb Client SDK and Dynamodb Document Client SDK links.
We love our contributors! If you'd like to contribute to the project, feel free to submit a PR. But please keep in mind the following guidelines:
FAQs
Dynamodb migrations for devops
The npm package dynamodb-migrations receives a total of 1,553 weekly downloads. As such, dynamodb-migrations popularity was classified as popular.
We found that dynamodb-migrations demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.