1111import errno
1212import sys
1313import time
14+ import re
1415from boto .dynamodb2 .layer1 import DynamoDBConnection
1516
1617JSON_INDENT = 2
@@ -49,6 +50,9 @@ def get_table_name_matches(conn, table_name_wildcard, separator):
4950 elif separator is None :
5051 if table_name .startswith (table_name_wildcard .split ("*" , 1 )[0 ]):
5152 matching_tables .append (table_name )
53+ elif separator == '' :
54+ if table_name .startswith (re .sub (r"([A-Z])" , r" \1" , table_name_wildcard .split ("*" , 1 )[0 ]).split ()[0 ]):
55+ matching_tables .append (table_name )
5256 elif table_name .split (separator , 1 )[0 ] == table_name_wildcard .split ("*" , 1 )[0 ]:
5357 matching_tables .append (table_name )
5458
@@ -71,6 +75,9 @@ def get_restore_table_matches(table_name_wildcard, separator):
7175 for dir_name in dir_list :
7276 if table_name_wildcard == "*" :
7377 matching_tables .append (dir_name )
78+ elif separator == '' :
79+ if dir_name .startswith (re .sub (r"([A-Z])" , r" \1" , table_name_wildcard .split ("*" , 1 )[0 ]).split ()[0 ]):
80+ matching_tables .append (dir_name )
7481 elif dir_name .split (separator , 1 )[0 ] == table_name_wildcard .split ("*" , 1 )[0 ]:
7582 matching_tables .append (dir_name )
7683
@@ -80,6 +87,9 @@ def get_restore_table_matches(table_name_wildcard, separator):
8087def change_prefix (source_table_name , source_wildcard , destination_wildcard , separator ):
8188 source_prefix = source_wildcard .split ("*" , 1 )[0 ]
8289 destination_prefix = destination_wildcard .split ("*" , 1 )[0 ]
90+ if separator == '' :
91+ if re .sub (r"([A-Z])" , r" \1" , source_table_name ).split ()[0 ] == source_prefix :
92+ return destination_prefix + re .sub (r"([A-Z])" , r" \1" , source_table_name ).split (' ' , 1 )[1 ].replace (" " , "" )
8393 if source_table_name .split (separator , 1 )[0 ] == source_prefix :
8494 return destination_prefix + separator + source_table_name .split (separator , 1 )[1 ]
8595
0 commit comments