0

The script saves the data to a csv file, this is the cur.execute command, and then nothing happens, just hangs in the same place, print(0) never prints

exit(),quit(),sys.exit() does not help

import teradatasql


def teradata_to_bigquery_export(bqproject = 'project', tddatabase = 'db', tdtable = 'table',bqdataset = 'dataset', gcpSA = 'key.json', host = 'host', user = 'user', password = 'pwd'):
        print(123)
        # teradata read data and save to dataframe
        with teradatasql.connect(host=host, user=user, password=password) as con:
            print(-2)
            with con.cursor() as cur:
                print(-1)
                cur.execute("{fn teradata_try_fastexport}{fn teradata_write_csv(myFile.csv)}SELECT * FROM " + tddatabase + "." + tdtable + " WHERE date_creation = CURRENT_DATE")
                print(0)
                cur.close()
        print(1)
Vitaliy Korolyk
  • 182
  • 2
  • 6
  • What is the string you send to `cur.execute` supposed to be? In particular, what should be the two double-bracketed strings at the start? And two comments: 1) you don't need triple-quotes when you have only one line; 2) instead of `{tddatabase + '.' + tdtable}` you can write `{tddatabase}.{tdtable}`. – OnDraganov Oct 05 '22 at 08:37
  • SQL should look like this: {fn teradata_try_fastexport}{fn teradata_write_csv(myFile.csv)}SELECT * FROM database.table WHERE date_creation = CURRENT_DATE but without the double curly braces the functions don't work, fn are teradata functions. Thanks for the comments. – Vitaliy Korolyk Oct 05 '22 at 08:50
  • Are you using most recent teradatasql? There were a couple recent fixes around FastExport with Write_CSV. – Fred Oct 06 '22 at 02:12
  • i ran pip install teradatasql --upgrade and then ran the code and same problem again – Vitaliy Korolyk Oct 06 '22 at 07:03
  • without {fn teradata_try_fastexport} its worked – Vitaliy Korolyk Oct 06 '22 at 08:38

1 Answers1

0

We would need to gather a debug log from you for troubleshooting. Please create a customer incident with Teradata Customer Support.

Tom Nolan
  • 394
  • 2
  • 5