Code Monkey home page Code Monkey logo

Comments (4)

HemangChothani avatar HemangChothani commented on September 26, 2024

@JHFVR I have tried to reproduce it , but not able to do that. Please verify it and let me know if i missed anything.

Sample Code:

from google.cloud import bigquery 
client = bigquery.Client()

schema = [  
    bigquery.SchemaField("File_Name", "STRING", mode="REQUIRED"),  
    bigquery.SchemaField("Age", "INTEGER"),  
    ] 

table = bigquery.Table('project_id.dataset.id', schema=schema)
table = client.create_table(table)
print (table.schema)

[SchemaField('File_Name', 'STRING', 'REQUIRED', None, ()),
SchemaField('Age', 'INTEGER', 'NULLABLE', None, ())]

dataset_ref = client.dataset("test_dataset")

job_config = bigquery.LoadJobConfig() 
job_config.write_disposition = bigquery.WriteDisposition.WRITE_TRUNCATE 
job_config.source_format = bigquery.SourceFormat.PARQUET 


load_job = client.load_table_from_uri(uri, dataset_ref.table("id"), job_config=job_config)
load_job.result()

destination_table = client.get_table(dataset_ref.table("id"))
print("Loaded {} schema.".format(destination_table.schema))

Loaded [SchemaField('File_Name', 'STRING', 'REQUIRED', None, ()), SchemaField('Age', ' 
 INTEGER', 'NULLABLE', None, ())] schema.

Also verify Parquet file schema:

import pyarrow.parquet as pq
pq.read_schema(local_file_path_parquet)

Output:

File_Name: string not null
Age: int64 
metadata
--------
OrderedDict([(b'ARROW:schema',............)])

from python-bigquery.

HemangChothani avatar HemangChothani commented on September 26, 2024

@JHFVR Any update on this?

from python-bigquery.

HemangChothani avatar HemangChothani commented on September 26, 2024

@JHFVR Any progress from your side? I am still not able to reproduce the issue.

from python-bigquery.

HemangChothani avatar HemangChothani commented on September 26, 2024

@JHFVR Please follow-up / reopen if you can provide more information.

from python-bigquery.

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.