Q:

python - Assigning a string to a field object

I'm working on Google BigQuery's python client.
I'm writing a program to automate the creation/exporting of tables.
Everything is working fine but there is a slight problem - I'd like to take in the schema of the table as an input from the user.
Here's how the table schema is assigned currently:
 table.schema = (
    bigquery.SchemaField('Name', 'STRING'),
    bigquery.SchemaField('Gender', 'STRING'),
    bigquery.SchemaField('Frequency', 'INTEGER')
)

It's hardcoded in the code.
I've written the code to process the user input and convert it to the format mentioned above.
What my code returns is a string - bq_schema - which looks like:
bigquery.SchemaField(Name, STRING),bigquery.SchemaField(Gender, STRING),bigquery.SchemaField(Frequency, INTEGER)

Now when I try to assign this string to the table schema,
table.schema = (bq_schema)

I get an error stating Schema items must be fields
So how do I make the table schema dynamic depending on the user input?
EDIT: As requested, here the code for converting user input to string:
s_raw = raw_input('\n\nEnter the schema for the table in the following format- fieldName:TYPE, anotherField:TYPE\n')
s = s_raw.split(',')
schema = []

for obj in s:
    temp = obj.split(':')
    schema.append(temp[0])
    schema.append(temp[1])

bq_schema = ''

for i in range(0, len(schema), 2):
    bq_schema+=('bigquery.SchemaField(\'{}\', \'{}\'),'.format(schema[i], schema[i+1])) 

A:

Question: What my code returns is a string - bq_schema  

What you are facing ist the __str__ Represantation of the bigquery object.
Change the following:
bq_schema = []
for i in range(0, len(schema), 2):
    bq_schema.append(SchemaField(schema[i], schema[i+1]))

