teradata

Connect Python to Teradata in mac with pyodbc

匿名 (未验证) 提交于 2019-12-03 02:34:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I successfully installed pyodbc module for python 2.7. However, when input the following code to connect to teradata, import pyodbc conn = pyodbc.connect('DRIVER={Teradata};DBCNAME=<tdwc>;UID=<UID>;PWD=<UID>;QUIETMODE=YES;') I got the following error; Traceback (most recent call last): File "", line 1, in pyodbc.connect('DRIVER={Teradata};DBCNAME=;UID=;PWD=;QUIETMODE=YES;') Error: ('00000', '[00000] [iODBC][Driver Manager]dlopen(/Library/Application Support/teradata/client/ODBC/lib/tdata.dylib, 6): Library not loaded: libtdparse

Teradata Update Table from Select Statement

匿名 (未验证) 提交于 2019-12-03 02:27:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Sorry if the title is unclear. Basically I'm trying to select certain records from multiple tables then update a certain column value for the returned records. T-SQL Implementation UPDATE CUSTOMERS SET LIKES_US = 'Y' FROM RESTAURANT REST INNER JOIN CUSTOMERS CUST ON REST.LINK_ID = CUST.LINK_ID WHERE REST.REST_TYPE = 'Diner' AND CUST.LIKES_US IS NULL Oracle UPDATE (SELECT CUST.LIKES_US FROM CUSTOMERS CUST INNER JOIN RESTAURANT REST ON CUST.LINK_ID=REST.LINK_ID WHERE REST.REST_TYPE = 'Diner' AND CUST.LIKES_US IS NULL) NEW_CUST SET NEW_CUST

Convert char to int TeraData Sql

匿名 (未验证) 提交于 2019-12-03 01:45:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: i'm trying to convert a column from char (8) to integer in order to make a referential integrity with an integer. IT didn't work and I test a select in order to check the cast. Utente_cd is a char(8) column SEL CAST(UTENTE_CD AS INTEGER) FROM TABLEA Teradata produces this error : SELECT Failed. 2621: Bad character in format or data of TABLEA. Sometime the char column contains also an alphanumeric code that I should discard. Thank you 回答1: In TD15.10 you can do TRYCAST(UTENTE_CD AS INTEGER) which will return a NULL instead of failing. Before

Writing Efficient Queries in SAS Using Proc sql with Teradata

拥有回忆 提交于 2019-12-03 01:38:20
EDIT: Here is a more complete set of code that shows exactly what's going on per the answer below. libname output '/data/files/jeff' %let DateStart = '01Jan2013'd; %let DateEnd = '01Jun2013'd; proc sql; CREATE TABLE output.id AS ( SELECT DISTINCT id FROM mydb.sale_volume AS sv WHERE sv.category IN ('a', 'b', 'c') AND sv.trans_date BETWEEN &DateStart AND &DateEnd ) CREATE TABLE output.sums AS ( SELECT id, SUM(sales) FROM mydb.sale_volue AS sv INNER JOIN output.id AS ids ON ids.id = sv.id WHERE sv.trans_date BETWEEN &DateStart AND &DateEnd GROUP BY id ) run; The goal is to simply query the table

ODBC Teradata Driver HY001 Memory allocation error. What is the meaning?

匿名 (未验证) 提交于 2019-12-03 01:35:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using the python script that inserts a batch of data into Teradata using the teradata python module with a script similar to the one below. It uses an ODBC connection and occasionally I get the following error: [HY001][Teradata][ODBC Teradata Driver] Memory allocation error . What does this error mean? And any suggestions on how to fix this? connection.executemany( 'INSERT INTO {}.{} ("{}") VALUES ({})' .format(database, table_name, '","'.join(column_names), ','.join(['?']*len(columns_names))), records_for_insert, batch=True ) 回答1: The

SQL to get distinct record for a combination of two column (Irrespective of order)

别来无恙 提交于 2019-12-02 21:17:19
问题 Consider the below Table structure and data CREATE TABLE Distance( source VARCHAR(20), destination VARCHAR(20), distance INTEGER ); Select * from Distance; source destination distance ======= =========== ====== Chennai Mumbai 500 Mumbai Chennai 500 Mumbai Bangalore 500 Bangalore Mumbai 500 Goa Mumbai 100 Mumbai Goa 100 Kolkata Goa 1000 I need the output to have single record for 2 cities if repeating, i,e, any one record among the below 2 is fine. Chennai Mumbai 500 Mumbai Chennai 500

SQL SELECT multi-columns INTO multi-variable

末鹿安然 提交于 2019-12-02 18:40:45
I'm converting SQL from Teradata to SQL Server in Teradata, they have the format SELECT col1, col2 FROM table1 INTO @variable1, @variable2 In SQL Server, I found SET @variable1 = ( SELECT col1 FROM table1 ); That only allows a single column/variable per statement. How to assign 2 or more variables using a single SELECT statement? SELECT @variable1 = col1, @variable2 = col2 FROM table1 Svetlozar Angelov SELECT @var = col1, @var2 = col2 FROM Table Here is some interesting information about SET / SELECT SET is the ANSI standard for variable assignment, SELECT is not. SET can only assign one

Timestamp to epoch conversion in teradata

旧巷老猫 提交于 2019-12-02 12:14:57
问题 I have a TIMESTAMP column in a teradata table. I want to convert the timestamp to epoch value. Can someone shed some light on how to do this. 回答1: This is a SQL UDF I wrote a few years ago. If you don't have access rights to create a function, you mighty ask you dab or simply cut & paste the calculation. /********** Converting a Timestamp to Unix/POSIX/epoch time Unix time: Number of seconds since 1970-01-01 00:00:00 UTC not counting leap seconds (currently 34 in 2010) The maximum range of

SQL to get distinct record for a combination of two column (Irrespective of order)

廉价感情. 提交于 2019-12-02 11:53:24
Consider the below Table structure and data CREATE TABLE Distance( source VARCHAR(20), destination VARCHAR(20), distance INTEGER ); Select * from Distance; source destination distance ======= =========== ====== Chennai Mumbai 500 Mumbai Chennai 500 Mumbai Bangalore 500 Bangalore Mumbai 500 Goa Mumbai 100 Mumbai Goa 100 Kolkata Goa 1000 I need the output to have single record for 2 cities if repeating, i,e, any one record among the below 2 is fine. Chennai Mumbai 500 Mumbai Chennai 500 Expected o/p: source destination distance ======= =========== ====== Chennai Mumbai 500 Mumbai Bangalore 500

Teradata Optimizer Equal vs Like in SQL

你离开我真会死。 提交于 2019-12-02 08:48:19
I am currently trying to optimize some bobj reports where our backend is Teradata. The Teradata optimizer seems very finicky and I was wondering if anyone has come up with a solution or a workaround to get the optimizer to treat likes in a similar regard to equals . My issue is that we allow the user to input one of two methods: 1. Enter the Number: or 2. Enter a Number like: Option one performs like a dream while option two is dragging our query times from 6 seconds to 2 minutes. In addition to this; does anyone know of any good articles, discussions, vidoes, etc.. on optimizing SQL