teradata

Why does Teradata Identity column have negative values?

∥☆過路亽.° 提交于 2019-12-11 11:40:30
问题 I am very new to Teradata (1 week) and my primary skillset is SQL Server. I am pulling data from one of the TeraData tables to SQL Server table and the TD table has an Identity column with negative values. I looked at the DDL for that table and it does not mention a start with and end with values. So, how does TeraData have the negative values in there? Also, if I pull this over to SQL Server, should I create a new Identity Column or should I just maintain the Identity values I get from

sqlalchemy reflected table not seeing primary key

隐身守侯 提交于 2019-12-11 11:36:35
问题 I have a sqlalchemy reflected table which points to a table in a teradata database. The problem is that the reflected table is apparenty not picking up on the primary key. td_engine = create_engine('teradata://'+user+':'+pswd+'@'+host) Session = sessionmaker() Session.configure(bind=td_engine) pswd = getpass('Password:') sess = Session() metadata = MetaData(td_engine) Base = declarative_base(cls=DeferredReflection) class myTable(Base): __tablename__ = "table_name" __table_args__ = {'schema':

How to specify Schema name while using @NamedStoredProcedureQuery

僤鯓⒐⒋嵵緔 提交于 2019-12-11 10:12:07
问题 I am trying to invoke a parameter less stored procedure using the Spring Annotation @NamedStoredProcedureQuery. Technology stack is Spring Data JPA with Hibernate, and database is Teradata. It always fails saying "Procedure not found" because it tries to invoke as call proc_name() which is bound to fail. However the right way to call the stored procedure is call schemaName.proc_name() I can't figure out a way to specify the schema name in the Entity that I have created.

How to output different 25th, 50th, 75th percentiles in single Teradata query?

。_饼干妹妹 提交于 2019-12-11 08:38:08
问题 I had got stuck few hours back on around something similar and worked out a less messy code for outputting 25th, 50th, 75th percentiles in a single Teradata query. Can be further extended to produce a " 5 point summary ". For minimum and maximum change static values according to your population estimate. Somewhere someone had asked for an elegant approach. Sharing mine. Here's the code: SELECT MAX(PER_MIN) AS PER_MIN, MAX(PER_25) AS PER_25, MAX(PER_50) AS PER_50, MAX(PER_75) AS PER_75, MAX

NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:teradata

[亡魂溺海] 提交于 2019-12-11 08:35:07
问题 Hi I am attempting to use sqlalchemy-teradata to write a pandas dataframe into a Teradata table. Here is the code I am using: from sqlalchemy import create_engine import sqlalchemy_teradata td_engine=create_engine('teradata://'+uid+':'+password+'@'+host+':22/') That comes back with the error above. I have also tried this code as well as I've seen this elsewhere on stackoverflow: engine=create_engine('teradata://'+ uid +':' + password + '@'+ host + '/' + '?authentication=LDAP') I have

sql rows into columns pivot table

梦想与她 提交于 2019-12-11 08:15:17
问题 I have sql view like this: id date_from date_to 1 2005-01-05 2005-05-10 1 2005-01-05 2005-05-10 1 2005-01-05 2005-05-10 2 2005-01-01 2006-08-31 2 2010-01-01 2010-06-30 3 2005-01-01 2005-06-30 And I want to write sql statement which returns: 1 2005-01-05 2005-05-10 2005-01-05 2005-05-10 2005-01-05 2005-05-10 2 2005-01-01 2006-08-31 2010-01-01 2010-06-30 NULL NULL 3 2005-01-01 2005-06-30 NULL NULL NULL NULL Any ideas? 回答1: Answers to Mark's question will help. Which RDBMS is this - MySQL,

JDBC reconnect problems with Teradata driver using Spring and Apache DataSource

两盒软妹~` 提交于 2019-12-11 08:04:41
问题 I'm using the Apache BasicDataSource for both commons DBCP and connection pool: org.apache.commons.dbcp.BasicDataSource and managing it through Spring: org.springframework.jdbc.datasource.DataSourceTransactionManager While using this combination with the Teradata JDBC driver if my database goes down or there is a network glitch I receive the following error: 08S01 804 : I/O Error, Socket closed. Packet stream write error Which reflects the situation correctly but the problem is with

Integer and not DECIMAL

时光总嘲笑我的痴心妄想 提交于 2019-12-11 07:49:50
问题 Why I am getting Integer in this output (I am expecting DECIMAL) Database flavor is Teradata What am I doing wrong? CASE WHEN sub_e.LSD IS NOT NULL THEN CAST(baba.amt AS DECIMAL(10,2)) ELSE 0 END - ( SUM( CASE WHEN sub_e.LSD IS NOT NULL THEN ch.actv_amt * (1 + ch.tax_percent_rate/100) ELSE 0 END ) ) + CASE WHEN sub_e.LSD IS NOT NULL THEN COALESCE(sub_e.PWC, 0) ELSE 0 END AS ODTS, 回答1: If TAX_RATE_PERCENT is not defined as a DECIMAL of sufficient precision then your calculation of (1 + TAX

Update error column parameter does not exist

Deadly 提交于 2019-12-11 06:16:12
问题 Trying to execute this query I've this error: Update failed. 3810: Column/parameter 'edw_workarea.A.A' does not exist. I'm using Teradata database. UPDATE A FROM EDW_WORKAREA.bs A, ( SELECT stg.ccir_ind_id, stg.orig_ccir_id FROM EDW_WORKAREA.se stg INNER JOIN best_svc bc ON stg.ccir_ind_id = bc.ccir_ind_id WHERE stg.deliverability_score < '6' AND stg.ccir_ind_id IN (SELECT stg.ccir_ind_id FROM EDW_WORKAREA.se stg WHERE stg.orig_ccir_id IS NULL OR stg.orig_ccir_id = '' GROUP BY stg.ccir_ind_id

Connect to Teradata Database using R + DBI library + ODBC

五迷三道 提交于 2019-12-11 06:09:02
问题 I'm trying to connect to a Teradata Database in R using the DBI library (if it matters I'm on Windows). I can successfully connect using the RODBC library so I know my credentials etc. are correct. I suspect the issue is: I am not correctly specifying the authentication mechanism Wrong driver: instead of using ODBC, perhaps I should be using JDBC? Background: First here's my ODBC info if I look it the ODBC Database Source Administrator: Name = name_name Driver = Teradata Name or IP address =