Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic Query #118

Open
deezelmunky opened this issue May 7, 2019 · 0 comments
Open

Dynamic Query #118

deezelmunky opened this issue May 7, 2019 · 0 comments

Comments

@deezelmunky
Copy link

I'm trying to write a program that modifies Teradata Table definitions to add Partitions as required. I would like to pull table and database names from a control table for starters and creating a show table SQL statement. My question is how can I feed the session.execute() function variables e.g. table and database names to export table definitions from Teradata. Here is what I have so far just to give a better idea:

with udaExec.connect("${dataSourceName}") as session:
for row in session.execute("SELECT * FROM ${table}"):
if row[2] == 'C':
print('Table has been purged')
elif row[2] == 'A':
for definition in session.execute ("SHOW TABLE "{row[0]}"."{row[1]}";"):
print(definition)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant