Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SimpleDB access library change to officel from libelycode/aws-lib #2

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
File renamed without changes.
72 changes: 49 additions & 23 deletions README.ja-JP.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,39 +20,49 @@ Apache License Version 2.0

## USAGE ##

node sdb2aztbl.js --config settings.json [ --tables table1,table2...] [--awsKey aws_access_key] [--awsSecret aws_secret_key]
[--sdbHostName sdb.ap-northeast-1.amazonaws.com] [--azureAccount azure_account]
node sdb2aztbl.js [-s] --config settings.json [ --tables table1,table2...] [--awsKey aws_access_key] [--awsSecret aws_secret_key]
[--sdbHostName us-east-1] [--azureAccount azure_account]
[--azureSecret azure_secret] [--partitionKey azure_storage_partition_key_template]
[--rowKey azure_storage_partition_key_template]

### 引数 ###
config 設定ファイル
tables 移行するドメイン名(テーブル名)カンマ区切りで複数指定可能
awsKey AWSのキー
awsSecret AWSシークレットキー
sdbHostName 移行元のAmazon SimpleDBのリージョンエンドポイント デフォルトは東京リージョン
azureAccount Windows Azure Storage アカウント名
azureSecret Windows Azure Storage シークレットキー
partitionKey "%Attribute1%-%Attribute2%"
rowKey "%Attribute1%-%Attribute2%"

PartitionKey、RowKeyの値文字列のフォーマットが可能です、後述のPartitionKeyとRowKeyについてを確認してください。


| Arg | Description | Example |
|:---------------|:--------------------------------------------------------------------------------------|:------------------------------|
| *s* | インポート時にエラーがある場合、エラーのレコードを表示し、その後インポートを継続します。 | |
| **config** | sdb2aztblの設定ファイル | `settings.json` |
| *sdbHostName* | 移行元のAmazon SimpleDBのリージョンエンドポイント、デフォルトはUS Eastリージョン | `sdb.us-east-1.amazonaws.com` |
| *awsKey* | AWSのキー | |
| *awsSecret* | AWSシークレットキー | |
| *tables* | 移行するドメイン名(テーブル名)カンマ区切りで複数指定可能 | `table1,table2` |
| *azureAccount* | Windows Azure Storage アカウント名. | |
| *azureSecret* | Windows Azure Storage シークレットキー | |
| *partitionKey* | Windows Azure TableのPartition keyフォーマット文字列 | `"%Attribute1%-%Attribute2%"` |
| *rowKey* | Windows Azure TableのRow keyフォーマット文字列. | `"%Attribute1%-%Attribute2%"` |

`PartitionKey`と`RowKey`は、値のフォーマットが可能です。詳しくはPartitionKeyとRowKeyについてを確認してください。

## 設定ファイル ##
引数に指定する他にsetting.jsonに指定する事も可能です。引数が指定されている場合は、引数の値が優先されます。

{
"awsKey": "AWSのキー",
"awsSecret": "AWSシークレットキー",
"sdbHostName": "移行元のAmazon SimpleDBのリージョンエンドポイント デフォルトはsdb.ap-northeast-1.amazonaws.com",
"sdbHostName": "移行元のAmazon SimpleDBのリージョンエンドポイント デフォルトはus-east-1",
"azureAccount": "Windows Azure Storage アカウント名",
"azureSecret": "Windows Azure Storage シークレットキー",
"tables": {
"移行元のAmazon SimpleDBのドメイン名": {
"replace": {
"PartitionKey": "%Attribute1%-%Attribute2%",
"RowKey": "%Attribute1%-%Attribute2%"
},
"Amazon SimpleDB's domain name or table name": {
"replace" : {
"PartitionKey" : {
"Value" : "%$Identity%",
"Padding" : "10"
},
"RowKey" : {
"Value" : "%$Identity%",
}
},
"type": {
"StringAttribute":"Edm.String",
"IntAttribute": "Edm.Int32",
Expand Down Expand Up @@ -81,9 +91,11 @@ SimpleDBのAttribute FirstNameとLastNameをスペースで結合して出力し

### 特殊識別子について ###

"%$ItemName%" AWS SimpleDB のItemName()列を出力します
"%$Identity%" 連番 0開始で1行づつインクリメントします
"%$Guid%" GUID値を生成します
| Identifier | Value |
|:--------------|:----------------------------------|
| "%$ItemName%" | AWS SimpleDB の`ItemName()`列を出力します. |
| "%$Identity%" | 連番 0開始で1行づつインクリメントします |
| "%$Guid%" | GUID値を生成します |

これらの機能を複数組み合わせて使う事も可能です。

Expand All @@ -95,6 +107,20 @@ SimpleDBのAttribute FirstNameの値が**PNOP**であった場合、以下のよ

"Azure_ACBB16CA-E78D-3B13-041-3CD2-8CC57221_PNOP_0"

### `partitionKey`と`rowKey`のゼロ埋めについて

`PartitionKey`と`RowKey`がの場合、指定した桁数でゼロ埋めが可能です。

"PartitionKey" : {
"Value" : "%$Identity%",
"Padding" : "10"
},


`PartitionKey`の値が1で、`Padding`の値が10の場合は以下の文字列を出力します。

"0000000001"

## typeについて ##

インポートする際に、明示的に型を指定する事ができます。指定が無い場合はEdm.Stringであるとしてインポートします。
Expand Down Expand Up @@ -136,7 +162,7 @@ SimpleDBのAttribute FirstNameの値が**PNOP**であった場合、以下のよ
}

## エラー時 ##
エラー出力にエラーの内容を出力します。また、インポート時に使えない文字列や最大入力から溢れた場合や例外発生時は、その場でエラーとして停止します。
エラー出力にエラーの内容を出力します。また、インポート時に使えない文字列や最大入力から溢れた場合や例外発生時は、その場でエラーとして停止します。`[ -s ]`が引数に指定されている場合は、エラーを出力後、処理を継続します。

## Windows / Max OS Xのnode.jsインストール##

Expand Down
59 changes: 42 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,21 @@ Apache License Version 2.0

## Usage

node sdb2aztbl.js --config settings.json [--tables table1,table2...] [--awsKey aws_access_key] [--awsSecret aws_secret_key]
[--sdbHostName sdb.ap-northeast-1.amazonaws.com] [--azureAccount azure_account]
node sdb2aztbl.js [-s] --config settings.json [--tables table1,table2...] [--awsKey aws_access_key] [--awsSecret aws_secret_key]
[--sdbHostName us-east-1] [--azureAccount azure_account]
[--azureSecret azure_secret] [--partitionKey azure_storage_partition_key_template]
[--rowKey azure_storage_partition_key_template]

### Arguments

| Arg | Description | Example |
|:---------------|:--------------------------------------------------------------------------------------|:------------------------------|
| **config** | Configration file of sdb2aztbl. | |
| *sdbHostName* | Migration source AWS SimpleDB's region endpoint. The default value are Tokyo region. | `sdb.ap-northeast-1.amazonaws.com` |
| *s* | Import error skip mode.It does not stop when an error occurs | |
| **config** | Configration file of sdb2aztbl. | `settings.json` |
| *sdbHostName* | Migration source AWS SimpleDB's region endpoint. The default value are Tokyo region. | `us-east-1` |
| *awsKey* | Key of AWS | |
| *awsSecret* | Sercret key of AWS | |
| *tables* | Migration source domain name (or table name) to be migrated, comma delimited. | |
| *tables* | Migration source domain name (or table name) to be migrated, comma delimited. | `name1,name2` |
| *azureAccount* | Migration destination Windows Azure Table storage account name. | |
| *azureSecret* | Migration destination Windows Azure Table storage account sercret key. | |
| *partitionKey* | Format string of the Windows Azure Table's partition key. | `"%Attribute1%-%Attribute2%"` |
Expand All @@ -49,15 +50,20 @@ The sdb2aztbl can configured other details from `setting.json`. If you configure
{
"awsKey": "<Your Key of AWS>",
"awsSecret": "<Your Secret key of AWS>",
"sdbHostName": "sdb.ap-northeast-1.amazonaws.com",
"sdbHostName": "us-east-1",
"azureAccount": "<Your Windows Azure Table storage account name>",
"azureSecret": "<Your Windows Azure Table storage account secret key>",
"tables": {
"Amazon SimpleDB's domain name or table name": {
"replace": {
"PartitionKey": "%Attribute1%-%Attribute2%",
"RowKey": "%Attribute1%-%Attribute2%"
},
"replace" : {
"PartitionKey" : {
"Value" : "%$Identity%",
"Padding" : "10"
},
"RowKey" : {
"Value" : "%$Identity%",
}
},
"type": {
"StringAttribute":"Edm.String",
"IntAttribute": "Edm.Int32",
Expand All @@ -67,7 +73,7 @@ The sdb2aztbl can configured other details from `setting.json`. If you configure
"GUIDAttribute": "Edm.Guid",
"DateTimeAttribute": "Edm.DateTime"
},
"where": "`BoolTest` = '1'"
"where": "`BoolAttribute` = '1'"
}
}
}
Expand All @@ -76,11 +82,11 @@ The sdb2aztbl can configured other details from `setting.json`. If you configure

You can formatting value of `partitionKey` and `rowKey`.

"partitionKey": "Any value of the fixed"
"partitionKey": { "value":"Any value of the fixed"}

You will output the value of any directly. In the following example, The `partitionKey` combined FirstName and LastName attribute of SimpleDB.

"partitionKey": "%FirstName% %LastName%"
"partitionKey": {"Value":"%FirstName% %LastName%"}

### Special identifier

Expand All @@ -98,6 +104,19 @@ If the value of the Attribute FirstName of SimpleDB was ** PNOP **, PartitionKey

"Azure_ACBB16CA-E78D-3B13-041-3CD2-8CC57221_PNOP_0"

### About `partitionKey` and `rowKey` padding

If RowKey and PartitionKey is numeric, Zero Padding of digits that you specify is possible.

"PartitionKey" : {
"Value" : "%$Identity%",
"Padding" : "10"
},

PartitionKey similar to the following is generated.

"0000000001"

### About `type` key

When you import, you can specify the type explicitly. The sdb2aztbl will import as a Edm.String If not specified. The type can be one of the following types that can be specified in the Windows Azure.
Expand All @@ -116,10 +135,15 @@ Notes: You do not designate type a `partitionKey` and `rowKey`.

"tables": {
"Migration source Amazon SimpleDB's domain name": {
"replace": {
"PartitionKey": "%Attribute1%-%Attribute2%",
"RowKey": "%Attribute1%-%Attribute2%"
},
"replace" : {
"PartitionKey" : {
"Value" : "%Attribute1%-%Attribute2%",
},
"RowKey" : {
"Value" : "%$Identity%",
"Padding" : "10"
}
},
"type": {
"PartitionKey": "Edm.String",
"RowKey": "Edm.String",
Expand All @@ -137,6 +161,7 @@ Notes: You do not designate type a `partitionKey` and `rowKey`.

## Errors
The sdb2aztbl's error detail output to standard error output. And sdb2aztbl stop immediately when caught the exception. (ex: string cannot be used for import)
[ -s ] argument is specified, it does not stop when an error occurs.

## How to install node.js on Windows / Max OS X

Expand Down
2 changes: 1 addition & 1 deletion node_modules/async/package.json

Large diffs are not rendered by default.

60 changes: 0 additions & 60 deletions node_modules/aws-lib/README.md

This file was deleted.

7 changes: 0 additions & 7 deletions node_modules/aws-lib/examples/cw.js

This file was deleted.

7 changes: 0 additions & 7 deletions node_modules/aws-lib/examples/ec2.js

This file was deleted.

7 changes: 0 additions & 7 deletions node_modules/aws-lib/examples/elb.js

This file was deleted.

23 changes: 0 additions & 23 deletions node_modules/aws-lib/examples/iam.js

This file was deleted.

7 changes: 0 additions & 7 deletions node_modules/aws-lib/examples/prod-adv.js

This file was deleted.

31 changes: 0 additions & 31 deletions node_modules/aws-lib/examples/ses.js

This file was deleted.

Loading