第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

嘗試使用 teradataml copy_to_sql 函數(shù)上傳熊貓數(shù)據(jù)框

嘗試使用 teradataml copy_to_sql 函數(shù)上傳熊貓數(shù)據(jù)框

猛跑小豬 2022-06-02 11:13:02
我對將數(shù)據(jù)上傳到 teradata 還是很陌生。我知道有效的方法是使用插入語句逐行插入,但希望避免這種情況。我正在嘗試將我的熊貓數(shù)據(jù)框直接上傳到 teradata,但尚未成功。我嘗試了 2 種方法,我的偏好是讓方法 1 起作用,但想先獲得一個可行的解決方案。我試過2種方法。1.Teradataml 模塊 - copy_to_sql 2.Teradata 模塊 - 使用插入語句方法 1 :使用copy_to_sql 函數(shù)創(chuàng)建表from teradataml.dataframe.copy_to import copy_to_sqlfrom teradataml import create_context, remove_contextdf # some dataframetable_name="db.table"copy_to_sql(df = df_new, table_name = "db.table", primary_index="index", if_exists="replace")方法2:使用插入語句添加到已創(chuàng)建的表中import teradataudaExec = teradata.UdaExec (appName=appname, version="1.0", logConsole=False)connect = udaExec.connect(method="odbc",system=host, username=user,                            password=passwrd)num_of_chunks=100table_name="db.table"query='INSERT INTO '+table_name+' values(?,?,?,?,?);'df_chunks=np.array_split(df_new2, num_of_chunks)for i,_ in enumerate(df_chunks):    data = [tuple(x) for x in df_chunks[i].to_records(index=False)]    connect.executemany(query, data,batch=True)**method 1** get the following error related to access.  Not sure while the SQL statement is adding quotes for the bolded table below:OperationalError: (teradatasql.OperationalError) [Version 16.20.0.48] [Session 5229096] [Teradata Database] [Error 3524] The user does not have CREATE TABLE access to database U378597.[SQL: CREATE multiset TABLE **"db.table"** (    "PBP" VARCHAR(1024) CHAR SET UNICODE,     recon VARCHAR(1024) CHAR SET UNICODE,     date2 TIMESTAMP(6),     "CF" FLOAT,     "index" VARCHAR(1024) CHAR SET UNICODE)primary index( "index" )]**method 2** get a error about inserting dates.  Assume datetime needs to be converted in someway to work in teradata table but unsure howDatabaseError: (6760, '[HY000] [Teradata][ODBC Teradata Driver][Teradata Database] Invalid timestamp. ')
查看完整描述

1 回答

?
守著一只汪

TA貢獻(xiàn)1872條經(jīng)驗 獲得超4個贊

thetable_name是一個不合格的名稱。要指定應(yīng)在其中創(chuàng)建表的 Teradata“數(shù)據(jù)庫”,請使用單獨(dú)的schema_name參數(shù)。

對于“方法 2”,請考慮使用teradatasql包而不是teradata. 或者我想你可以.isoformat(' ')時間戳。


查看完整回答
反對 回復(fù) 2022-06-02
  • 1 回答
  • 0 關(guān)注
  • 110 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號