Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using client library with Angular #55

Open
garethquirke opened this issue Jul 23, 2019 · 1 comment
Open

Using client library with Angular #55

garethquirke opened this issue Jul 23, 2019 · 1 comment

Comments

@garethquirke
Copy link

Hi,
Trying to use this client with angular project and running into several issues.

const { athena } = require('athena-client');

@Injectable({
  providedIn: 'root'
})
export class AthenaTestGqService {

  clientConfig = {
    bucketUri: constants.aws.athena.tempLocation
  };

  awsConfig = {
    region: constants.aws.region
  };


  constructor() {

    const client = athena.createClient(this.clientConfig, this.awsConfig);

    client.execute('SELECT * FROM my_table LIMIT 20', function (err, data) {
      if (err) {
        console.log(err);
      }
      console.log(data);
    });

  }
}

The error this produces is

TypeError: Cannot read property 'createClient' of undefined

@KoteiIto
Copy link
Owner

Here is the correct import .

const { createClient } = require('athena-client');
...
const client = createClient(this.clientConfig, this.awsConfig);

or

const athena = require('athena-client');
...
const client = athena.createClient(this.clientConfig, this.awsConfig);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants