Coder Social home page Coder Social logo

Comments (7)

tswast avatar tswast commented on May 19, 2024 3

Actually, I think the current API does support this, even without #25. The read_gbq function accepts a configuration keyword argument which is a job configuration resource, so to allow large results one would do either

Standard SQL:

pd.read_gbq(
    query,
    'my-project',
    dialect='standard',
    configuration={
        'query': {
            'destinationTable': {
                'projectId': 'my-project',
                'datasetId': 'mydataset',
                'tableId': 'mytable'
             }
        }
    })

Legacy SQL:

pd.read_gbq(
    query,
    'my-project',
    dialect='standard',
    configuration={
        'query': {
            'allowLargeResults': True,
            'destinationTable': {
                'projectId': 'my-project',
                'datasetId': 'mydataset',
                'tableId': 'mytable'
             }
        }
    })

Admittedly this is a bit onerous to do. We may wish to provide a friendlier interface for options such as these.

from python-bigquery-pandas.

jasonqng avatar jasonqng commented on May 19, 2024 2

Can now do this in open PR by passing it via configuration setting: #25

read_gbq(sql, configuration={"allow_large_results":True})

This uses new google-cloud-python api.

from python-bigquery-pandas.

tswast avatar tswast commented on May 19, 2024

People have posted some pretty elaborate workarounds on StackOverflow. https://stackoverflow.com/questions/34201923/python-bigquery-allowlargeresults-with-pandas-io-gbq/34203369

from python-bigquery-pandas.

yahyamortassim avatar yahyamortassim commented on May 19, 2024

@jasonqng you also have to add destinationTable.

from python-bigquery-pandas.

Gitman-code avatar Gitman-code commented on May 19, 2024

The updated answer on stack overflow suggests just using dialect='standard' like tswast did but more simply as
pd.read_gbq(query, 'my-super-project', dialect='standard')

and notes AllowLargeResults: For standard SQL queries, this flag is ignored and large results are always allowed. This worked for me but maybe it is not generic.

from python-bigquery-pandas.

tswast avatar tswast commented on May 19, 2024

I'm glad that worked for you. I believe there may be some size threshold where a destination table is required, even with standard SQL, but perhaps the threshold is larger than it was for legacy SQL.

from python-bigquery-pandas.

tswast avatar tswast commented on May 19, 2024

Closing, as this can be passed in via the configuration argument to read_gbq.

from python-bigquery-pandas.

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.