teodevgroup / teo

Schema-driven web server framework.
https://teodev.io
Apache License 2.0
1.41k stars 46 forks source link

BigQuery support #43

Open w113st opened 9 months ago

w113st commented 9 months ago

Hi, can you support BigQuery?

victorteokw commented 9 months ago

Hi @w113st, What is BigQuery?

victorteokw commented 9 months ago

@w113st, could you please star this repo? Thanks

victorteokw commented 9 months ago

@w113st, Is it a database? Are you familiar with Teo? How do you think to support it?

w113st commented 9 months ago

Hi Victor, it's Google's relational database that supports geoqueries. 10 GiB of data is free. You can use node package like this:

const {BigQuery} = require('@google-cloud/bigquery');
const bigquery = new BigQuery();

async function queryWithPagination(pageNumber, resultsPerPage) {
  const query = `
    SELECT *
    FROM your_table
    ORDER BY some_column
    LIMIT @resultsPerPage
    OFFSET @offset
  `;

  const options = {
    query: query,
    params: {resultsPerPage, offset: (pageNumber -  1) * resultsPerPage},
    location: 'US',
  };

  const [rows] = await bigquery.query(options);
  return rows;
}

There's a local emulator you can use for testing: https://github.com/goccy/bigquery-emulator

victorteokw commented 9 months ago

@w113st, I think in the future, Cassandra and BigQuery will be supported. The current SQL connector cannot support BigQuery.

w113st commented 9 months ago

Ok sure thank you. I will keep following your work after GraphQL Joker

victorteokw commented 9 months ago

Thanks @w113st