Created
June 22, 2017 04:45
-
-
Save nikparmar/af8b81e9290c922761f92ec504654836 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pynamodb.models import Model | |
from pynamodb.attributes import ( | |
UnicodeAttribute, | |
JSONAttribute | |
) | |
from settings import DYNAMO_SETTINGS | |
__all__ = [ | |
"TwitterStreamData", | |
"TwitterExcelData", | |
] | |
class TwitterStreamData(Model): | |
class Meta: | |
write_capacity_units = 2 | |
read_capacity_units = 2 | |
table_name = "TwitterStreamData" | |
host = DYNAMO_SETTINGS['HOST'] | |
region = DYNAMO_SETTINGS['REGION'] | |
_id = UnicodeAttribute(hash_key=True) | |
data = JSONAttribute() | |
class TwitterExcelData(Model): | |
class Meta: | |
write_capacity_units = 5 | |
read_capacity_units = 1 | |
table_name = "TwitterExcelData" | |
host = DYNAMO_SETTINGS['HOST'] | |
region = DYNAMO_SETTINGS['REGION'] | |
_id = UnicodeAttribute(hash_key=True) | |
data = JSONAttribute() | |
if not TwitterStreamData.exists(): | |
TwitterStreamData.create_table(wait=True) | |
if not TwitterExcelData.exists(): | |
TwitterExcelData.create_table(wait=True) | |
if __name__ == "__main__" and __package__ is None: | |
__package__ = "twitter_code_base.services" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment