0

I want to get the columns of multiple tables in SAP HANA database. I am using hdbcli and it is giving error :

hdbcli.dbapi.Error: (362, 'invalid schema name: INFORMATION_SCHEMA: line 1 col 15

Python code :

import hdbcli
from hdbcli import dbapi
import pandas as pd
from google.cloud import bigquery
conn = dbapi.connect(
       address="example.hana.trial-us10.hanacloud.ondemand.com",
    port=443,
    user='DBADMIN', 
    password='example@xxxxxx'
)

tables = ['table1', 'table2', 'table3']
for table in tables:
    cursor = conn.cursor()
    cursor.execute(f"SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='{table}'")
    print(f"Table '{table}' description:")
    print([column[3] for column in cursor.fetchall()])
    cursor.close()

conn.close()

need some help to proceed. Thanks

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Sandeep Mohanty
  • 1,419
  • 5
  • 13
  • 1
    Does this answer your question? [HANA list / show tables SQL Command](https://stackoverflow.com/questions/41727670/hana-list-show-tables-sql-command) – Lars Br. Jan 31 '23 at 22:15
  • Hi @LarsBr. my requiremrnt is to retrieve the columns of multiple tables. How can i acheive thst – Sandeep Mohanty Feb 01 '23 at 04:02

0 Answers0