GithubHelp home page GithubHelp logo

tristanbilot / bqfetch Goto Github PK

View Code? Open in Web Editor NEW
27.0 3.0 3.0 196 KB

A lightweight tool to fetch tables from BigQuery as pandas DataFrame very fast using BigQuery Storage API combined with multiprocessing

License: MIT License

Python 100.00%
bigquery python gcp bigquery-storage-api fetch multiprocessing database data-science analytics

bqfetch's People

Contributors

tristanbilot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

bqfetch's Issues

Error when importing bqfetch

Hi everyone !

I'm trying to read a big table from BigQuery using python in google colab and I found bqfetch, however, when I try to import BigQueryFetcher and BigQueryTable I get an error.
I installed it by doing:

!pip install bqfetch
!pip install -r requirements.txt

But when running the second command, I get this error:

ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'

Then, my code is this:

from bqfetch import BigQueryFetcher, BigQueryTable

table = BigQueryTable("PROJECT", "DATASET", "TABLE")
fetcher = BigQueryFetcher('/path/to/bq_service_account.json', table)
chunks = fetcher.chunks('id', by_chunk_size_in_GB=2)

for chunk in chunks:
    df = fetcher.fetch(chunk, nb_cores=1, verbose=True)

Am I doing something wrong ? Because this is what I get:

Captura de pantalla 2023-05-08 a las 16 23 49

Some help would be appreciated! Because I cannot run anything so I can't get the table I need in order to have as a dataframe in python :(

Thank you in advance!
Marina

bqfetcher json file path

Hi Team,
I'm trying to use bqfetch library to fetch bigquery table.
I would like to know whether what file are you referring to . can you elaborate more about and where can I JSON file in my project.
since I dont see enough info in github repo, raising this request.
fetcher = BigQueryFetcher('/path/to/service_account.json', table)

Thanks in advance.
Regards
Nirmal NK

service account and dataset in different projects

Hello,

thank you very much for the library, I agree it seems to be very promising!

Is it possible to add the project id as a parameter of the BigQueryClient?

Sometimes the project where the service account was created and the project of the dataset to be accessed may be different, for example in my case it fails due to the lack of the correct roles/permissions in the service account project, so the following piece of code of bqfetch.py fails:

          bq_client = bigquery.Client(
               credentials=credentials,
               project=credentials.project_id
           )

while using directly bigquery.Client():

bigquery.Client(credentials=credentials, project=bq_project_id)

works correctly.

Thank you,
Steven

InvalidChunkRangeException

Hello,
Thank you for a such useful library!

I am trying to fetch the table as it mentioned on the column that contains distinct values, but anyway getting an error:

InvalidChunkRangeException: Difference of range between elements of column datetime_tzutc is too high: more than 25.0% of elements are too far from the mean.

Could you, please, give me advices how should I handle this case?
Thank you in advance!

Best,
Veniamin

Support for fetching only specific partition(s)

Hi @TristanBilot, first of all thanks for creating this library - seems to be very promising!
I was exploring using it in one of my projects and realized that it would be great if it supported fetching data only from specific partition(s) as opposed to the whole table.

Do you have any plans on adding that feature?

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.