Questions tagged [teradatasql]

The Teradata SQL Driver for Python (or related drivers). For Teradata (Vantage) database questions, use the [teradata] tag instead.

The Teradata SQL Driver for Python is a DBAPI Driver that enables Python applications to connect to the Teradata Database. The Teradata SQL Driver for Python implements the PEP-249 Python Database API Specification 2.0.

It is available from PyPI or Teradata's public download site and is used by the Teradata Python Package (teradataml) and the Teradata SQL Driver Dialect for SQLAlchemy (teradatasqlalchemy) to connect to a Teradata DBMS, aka Teradata Vantage SQL Engine. This driver is also leveraged by the Vantage Modules for Jupyter and is closely related to the Teradata SQL Drivers for R and Node.js.

272 questions
0
votes
1 answer

How to pass encoding in Teradatasql?

I need to connect to a Teradata table which has encoding = "Latin-OA", using teradatasql in python. I tried to pass encoding as a parameter but I don't think it is the correct syntax: with teradatasql.connect(host='xx.xx.xx', user='xyz', …
Gary
  • 31
  • 1
  • 6
0
votes
0 answers

Extract Last 35 days data prior to the last 7 days in Teradata

I want to extract the last 35 days prior to the 7days before the max date in the dataset. Here the analysis is for days and not weeks. For example: Max date is 10 March 2022 so I want date range to be between 29 Jan to 3 March. I want to repeat this…
Nithya
  • 33
  • 4
0
votes
0 answers

PySpark with a Teradata connection

Currently I'm using the following method to convert a SQL query to a Pandas Dataframe import teradatasql as tsql import pandas as pd with tsql.connect(host="xxx", user="xxx", password="xxx") as connect: …
Jero
  • 15
  • 1
  • 6
0
votes
0 answers

Teradata : ByteInt format , Compress and Numeric Overflow

I am working on an existing script where the format of one of the columns is set as : column A BYTEINT Compress (0,1,2,3,4,5,6,7,8,9,NULL) The possible values for this field lie between 1 - 899 or null. However, when I try to insert the data…
0
votes
3 answers

Alternative for teradata functions in snowflake

Is there any alternative functions in snowflake for below teradata functions ? DAYNUMBER_OF_CALENDAR(), DayOccurrence_Of_Month(), WeekNumber_Of_Calendar(), MonthNumber_Of_Quarter(), QuarterNumber_Of_Year(),
0
votes
1 answer

Alternative for Sys_Calendar of teradata in snowflake

Do we have any alternative for teradata Sys_Calendar.CALENDAR function in snowflake? I couldnt find any table or builtin functions to achive this [The Sys_Calendar.CALENDAR system view helps to extend the properties of a DATE data type column by…
0
votes
0 answers

unable to execute sql query in teradata using teradatasql python module

I want to run a SQL query in Teradata using the Teradata SQL python module. I am getting the below error. Code: import teradatasql conn='{"host":"hostname","logmech":"KRB5"}' cxnn=teradatasql.connect(conn)
rock
  • 1
  • 3
0
votes
0 answers

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf6 in position 3: invalid start byte in pyodbc module

I want to run a sql statement using python module pyodbc in teradata. I have teradata installed already then I installed pyodbc module using pip. While executing pyodbc connect I am facing below issue UnicodeDecodeError: 'utf-8' codec can't decode…
rock
  • 1
  • 3
0
votes
1 answer

Teradata SQL Regex Question - Extract Numeric values after an Alpha

I am trying to run a select statement on a table acct id. My account ID's can have the following pattern which is the one I am having issues with: 2733R9087813964 How do I run a SELECT Statement on this column and extract only the numeric portion…
DenairPete
  • 61
  • 1
  • 4
0
votes
0 answers

For loops in Teradata SQL

I'm trying to understand how to use FOR loops in Teradata SQL. I used the very same example that you find in Teradata documentation FOR CustCursor AS c_customer CURSOR FOR SELECT CustomerNumber ,CustomerName FROM Customer DO SET…
Jero
  • 15
  • 1
  • 6
0
votes
1 answer

Teradata create volatile doesn't work on JDBC

When running the following Python code and SQL query on a Teradata Vantage Express server: #!/usr/bin/env python3 import teradatasql query = """CREATE VOLATILE TABLE target_table AS ( select * FROM MY_DB.MY_TABLE ) WITH DATA ON COMMIT…
0
votes
0 answers

Teradata CASE WHEN attribute IN ( Select... from)

I have selected a bunch of IDs and I try to use CASE WHEN to get a column when the IDs which I really want to select are in the IDs I selected earlier. But it shows Select Failed .3771:Illegal expression in WHEN clause of Case expression. Any…
0
votes
2 answers

UNION not working Teradata SQL. Syntax error: Top N option is not allowed in a query connected by set operators

When I run both queries individually, they run correctly. But when I try to combine both result sets into one table using the UNION operator, it doesn't run and I get the error message : "Syntax error: Top N option is not allowed in a query…
JohnnyDevv
  • 25
  • 5
0
votes
0 answers

Importing data from Flat file into Teradata table

I have a tab delimited flat file(.txt) like below and i want to import data into one Teradata table whose datatype is mentioned: CALENDAR_DATE NRDP_ETL_SCOPE_START_DATE FISCAL_PERIOD_WEEK 12/30/2022 12/22/2022 2022-01 W2 12/31/2022 12/22/2022 …
0
votes
1 answer

how to convert xmlget and xmlelement from teradata to snowflake

Below is the teradata code i want to convert to snowflake select XMLAGG (XMLELEMENT (n, col1 || CHR (10)) ORDER BY num ).EXTRACT ('//text()').getClobVal () AS abc tried as below but not working. am new to both oracle and snowflake…