Pynamodb Transaction not using local endpoint

305 Views Asked by At

Regardless of whatever I tried, pynamodb is not connecting to my local dynamodb.

Below is my model,

class OrderMarker(Model):
    class Meta:
        table_name = 'ddb_mrker_table'
        connection = TableConnection(table_name='ddb_mrker_table', host='http://localhost:8000')
    OrderUniqueueId = UnicodeAttribute(hash_key=True)

Below is the exception,

Traceback (most recent call last):
  File "C:\backend\orders\snapshot\app.py", line 451, in <module>
    main()
  File "C:\backend\orders\snapshot\app.py", line 445, in main
    OrderMarker.create_table(wait=True)
  File "C:\Users\user1\AppData\Local\Programs\Python\Python39\lib\site-packages\pynamodb\models.py", line 798, in create_table
    if not cls.exists():
  File "C:\Users\user1\AppData\Local\Programs\Python\Python39\lib\site-packages\pynamodb\models.py", line 762, in exists
    cls._get_connection().describe_table()
  File "C:\Users\user1\AppData\Local\Programs\Python\Python39\lib\site-packages\pynamodb\connection\table.py", line 294, in describe_table
    return self.connection.describe_table(self.table_name)
  File "C:\Users\user1\AppData\Local\Programs\Python\Python39\lib\site-packages\pynamodb\connection\base.py", line 787, in describe_table
    raise TableError("Unable to describe table: {}".format(e), e)
pynamodb.exceptions.TableError: Unable to describe table: Could not connect to the endpoint URL: "https://dynamodb.us-east-1.amazonaws.com/"

As you can see , pynamodb is trying to access https://dynamodb.us-east-1.amazonaws.com/ eventhough I have specified the local endpoint url. This is the case always, even when I try transactions too.

Local ddb server is run as shown below,

java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -inMemory -delayTransientStatuses

A quick check using aws dynamodb list-tables --endpoint-url http://localhost:8000 shows local server is running fine!

Any idea?

0

There are 0 best solutions below