我想像使用 gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long
id)
{
if (clickcheck.get(position).equals(true)) {
//complete some task then
position=position+1;
clickcheck.remove(position);
clickcheck.add(position,true);
}
else
{
Toast.makeText(getActivity(), "Click On Level "+position, Toast.LENGTH_SHORT).show();
}
一样使用我的python代码获取数据。我想在Redshift和DB2上做到这一点。
我尝试使用熊猫和光标来做到这一点,我尝试了以下命令块:
describe [tableName] statement
"set search_path to SCHEMA; select * from pg_table_def where schemaname = 'schema' and LOWER(tablename) = 'TableName';
describe schema.tableName
select column_name, data_type, character_manimum_length from information_schema.columns where table_schema = 'Schema' and table_name = 'TableName';
。
\d or \d+
我希望输出如下:
import psycopg2
import numpy as np
import pandas as pd
con=psycopg2.connect(dbname= 'DBNAME', host="Host-Link",
port= '5439', user= 'username', password= 'password')
print(con)
cur = con.cursor()
query = "set search_path to Schema; select * from pg_table_def where schemaname = 'Schema' and LOWER(tablename) = 'TableName';"
cur.execute(query)
temp = cur.fetchall()
print(temp)
data_frame = pd.read_sql("set search_path to Schema; select * from pg_table_def where schemaname = 'Schema' and LOWER(tablename) = 'TableName';", con)
print(data_frame)
con.close()
答案 0 :(得分:0)
SVV_COLUMNS
系统视图中包含许多此类数据。您可以使用table_name
和table_schema
列来查询该表。
https://docs.aws.amazon.com/redshift/latest/dg/r_SVV_COLUMNS.html