Giter Site home page Giter Site logo

not listing tables about faraday HOT 14 CLOSED

sibelius avatar sibelius commented on August 18, 2024
not listing tables

from faraday.

Comments (14)

sibelius avatar sibelius commented on August 18, 2024 1

not sure what the problem was, maybe some old dynamodb running

I've changed the dynamolocal, and it is working fine now

tks

from faraday.

kipz avatar kipz commented on August 18, 2024 1

Glad it's all working now.

from faraday.

sibelius avatar sibelius commented on August 18, 2024

version: [com.taoensso/faraday "1.11.0-alpha1"]

from faraday.

ianffcs avatar ianffcs commented on August 18, 2024

maybe you have a .aws config that is shadowing your current ":endpoint" keyword value, maybe pass :endpoint "http://localhost:6798" to client-opts map?

from faraday.

sibelius avatar sibelius commented on August 18, 2024

I have this

(def client-opts { :access-key 'access-key' :secret-key 'secret-key' :endpoint 'http://localhost:8000'})

is this enough?

how can I debug this further?

from faraday.

kipz avatar kipz commented on August 18, 2024

Shouldn't the values be in double quotes to make them into strings? Perhaps a copy/paste issue?

(def client-opts { :access-key "" :secret-key "" :endpoint ""})

Though I expect you would see some exceptions if they weren't strings

from faraday.

sibelius avatar sibelius commented on August 18, 2024

I've tried this

(def client-opts { :access-key "" :secret-key "" :endpoint "http://localhost:8000"})

and it is not working as well

from faraday.

sibelius avatar sibelius commented on August 18, 2024

this is how I'm creating my tables

table definition: based on https://github.com/runopsio/sequence

{
  "TableName": "decimals",
  "ProvisionedThroughput": { "ReadCapacityUnits": 1, "WriteCapacityUnits": 1 },
  "AttributeDefinitions": [
    { "AttributeName": "PK", "AttributeType": "S" },
    { "AttributeName": "SK", "AttributeType": "S" },
    { "AttributeName": "GSI1_PK", "AttributeType": "S" },
    { "AttributeName": "LSI1_SK", "AttributeType": "S" },
    { "AttributeName": "GSI1_SK", "AttributeType": "S" }
  ],
  "KeySchema": [
    { "AttributeName": "PK", "KeyType": "HASH" },
    { "AttributeName": "SK", "KeyType": "RANGE" }
  ],
  "GlobalSecondaryIndexes": [
    {
      "IndexName": "LSI1",
      "KeySchema": [
        { "AttributeName": "PK", "KeyType": "HASH" },
        { "AttributeName": "LSI1_SK", "KeyType": "RANGE" }
      ],
      "Projection": { "ProjectionType": "ALL" },
      "ProvisionedThroughput": {
        "ReadCapacityUnits": 1,
        "WriteCapacityUnits": 1
      }
    },
    {
      "IndexName": "GSI1",
      "KeySchema": [
        { "AttributeName": "GSI1_PK", "KeyType": "HASH" },
        { "AttributeName": "GSI1_SK", "KeyType": "RANGE" }
      ],
      "Projection": { "ProjectionType": "ALL" },
      "ProvisionedThroughput": {
        "ReadCapacityUnits": 1,
        "WriteCapacityUnits": 1
      }
    }
  ]
}

create table using dynamodb cli

aws dynamodb create-table --cli-input-json file://sequence.json --endpoint-url http://localhost:8000

list tables

aws dynamodb list-tables --endpoint-url http://localhost:8000

from faraday.

kipz avatar kipz commented on August 18, 2024

Do these steps work for you as they do for me?

docker run -p 8000:8000 amazon/dynamodb-local
(require '[taoensso.faraday :as far])
(def client-opts {:access-key "" :secret-key "" :endpoint "http://localhost:8000"})
(far/list-tables client-opts)
;; => ()
;; from the docs
(far/create-table client-opts :my-table
                             [:id :n]  ; Primary key named "id", (:n => number type)
                             {:throughput {:read 1 :write 1} ; Read & write capacity (units/sec)
                              :block? true ; Block thread during table creation
                              })
(far/list-tables client-ops)
;; =>  (:my-table)

Almost certainly not related, but are you able to upgrade to the latest release from the alpha?

from faraday.

sibelius avatar sibelius commented on August 18, 2024

I've made a javascript script to list tables similar to far/list-tables

https://gist.github.com/sibelius/6430d1ad9390b83a40f1c600d7c159f1

If I do (far/create-table) I can see the table in (far/list-tables)

the problem is to list already existing tables

one problem that I see with (far/create-table) is that I can't see that table using

aws dynamodb cli, neither using dynamodb admin (https://github.com/aaronshaf/dynamodb-admin)

it looks like it is querying a different database

can I specify the region of my database?

from faraday.

kipz avatar kipz commented on August 18, 2024

I agree. Seems like somehow you are connecting to a different database.

You can pass in :region in the client-opts map instead of the :endpoint (as of version 1.11.0 I think)

from faraday.

sibelius avatar sibelius commented on August 18, 2024

(def client-opts { :access-key "dummy" :secret-key "dummy" :endpoint "http://localhost:8000" :region "us-east-1"})

this get me this error on region

Cannot cast java.lang.String to com.amazonaws.regions.Region

from faraday.

kipz avatar kipz commented on August 18, 2024

I'm not sure it makes sense to set a region as well as an endpoint, but in any case, I think you've stumbled on a bug. I've raised it here.

However, I think bug #152 is unrelated to what you are seeing with the different databases - you should be able to continue using endpoint in client-opts.

from faraday.

sibelius avatar sibelius commented on August 18, 2024

this stackoverflow can give more insights for the issue

https://stackoverflow.com/questions/29558948/dynamo-local-from-node-aws-all-operations-fail-cannot-do-operations-on-a-non-e

it looks like if you are using different profiles you get different databases

can I set a profile in client-opts ?

from faraday.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.