Skip to content

Keyspace creation vs Keyspace Retrieval Regex #94

Open
@roybarber

Description

I'm able to create a Keyspace both via REST API and Admin area with the value "2DQJAUtSzzzKP9buDTvUvPk3" but unable to retrieve and use it via the REST api.

const dbAdmin = admin.dbAdmin(dbEndpoint)
await dbAdmin.createKeyspace('2DQJAUtSzzzKP9buDTvUvPk3')

// then i can list: 
const keyspaces = await dbAdmin.listKeyspaces()
console.log(keyspaces)

{
  "existingKeyspaces": [
    "default_keyspace",
    "2DQJAUtSzzzKP9buDTvUvPk3"
  ]
}

Then when trying to use the keyspace:

const collectionNames = await db.listCollections({ nameOnly: true, keyspace: '2DQJAUtSzzzKP9buDTvUvPk3' })
// or 
await db.createCollection('collectionname', { keyspace: '2DQJAUtSzzzKP9buDTvUvPk3' })

This returns:

DataAPIResponseError: Request invalid: field 'keyspace' value "2DQJAUtSzzzKP9buDTvUvPk3" not valid. Problem: must match "[a-zA-Z][a-zA-Z0-9_]*".

Activity

toptobes

toptobes commented on Jan 1, 2025

@toptobes
Collaborator

Hi Roy, thanks for finding this out.

This is not an actually issue with the client, but with the Data API itself; I think the ability to create a keyspace starting with a number is relatively new, because I don't recall that being possible before, but I may be misremembering.

Nevertheless, I'll pass it onto the team on your behalf, and keep you updated. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Data API issueIssue arises from the Data API, not the client

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Keyspace creation vs Keyspace Retrieval Regex · Issue #94 · datastax/astra-db-ts