Oracle安装提示无效条目,Oracle错误:无效的标识

我正在尝试使用python访问和更新Oracle数据库。以下是我的代码:import cx_Oracle

import pandas as pd

import datetime

import numpy

import math

#import pandasql

conn_str = 'sahil/sahil@52.20.141.126:1521/xe'

conn = cx_Oracle.connect(conn_str)

c = conn.cursor()

def update_output_table(customer_id_list,column_name,column_vlaue_list) :

num_rows_to_add = len(customer_id_list)

conn = cx_Oracle.connect(conn_str)

c = conn.cursor()

for i in range(0,num_rows_to_add,1) :

c.execute("""UPDATE output SET """+column_name+""" = %s WHERE customer_id = %s""" %(column_vlaue_list[i],customer_id_list[i]))

print "Completed updating " + column_name

conn.commit()

total_transaction_df = pd.read_sql("""select distinct b.customer_id,count(a.transaction_id) as total_transaction from transaction_fact a,customer_dim b where a.customer_id = b.customer_id group by b.customer_id""",conn)

# Update this details to the output table

update_output_table(list(total_transaction_df['CUSTOMER_ID']),'TOTAL_TRANSACTION',list(total_transaction_df['TOTAL_TRANSACTION']))

english_movies_df = pd.read_sql("""select b.customer_id, count(a.product_id) as "ENGLISH_MOVIES" from transaction_fact a inner join customer_dim b on a.customer_id = b.customer_id where a.product_id like 'E%' group by b.customer_id""",conn)

# Update this details to the output table

update_output_table(list(english_movies_df['CUSTOMER_ID']),'ENGLISH_MOVIES',list(english_movies_df['ENGLISH_MOVIES']))

hindi_movies_df = pd.read_sql("""select b.customer_id, count(a.product_id) as "HINDI_MOVIES" from transaction_fact a inner join customer_dim b on a.customer_id = b.customer_id where a.product_id like 'H%' group by b.customer_id""",conn)

# Update this details to the output table

update_output_table(list(hindi_movies_df['CUSTOMER_ID']),'HINDI_MOVIES',list(hindi_movies_df['HINDI_MOVIES']))

most_popular_genre_df = pd.read_sql("""select x.customer_id, x.genre as "MOST_POPULAR_GENRE",x.count1 from (select b.customer_id,c.genre,count(a.transaction_id) as count1, RANK() OVER (PARTITION BY b.customer_id order by count(a.transaction_id) desc,c.genre) as Rank1 from transaction_fact a inner join customer_dim b on a.customer_id = b.customer_id inner join product_dim c on a.product_id = c.product_id group by b.customer_id, c.genre)x where x.Rank1 = 1""",conn)

# Update this details to the output table

update_output_table(list(most_popular_genre_df['CUSTOMER_ID']),'MOST_POPULAR_GENRE',list(most_popular_genre_df['MOST_POPULAR_GENRE']))

conn.close()

除了最后一次调用update_output_table之外,整个脚本都在执行中,它给出了ORA-00904 : 'UNCONVENTIONAL' invalid identifier。在

我传递了正确的列名。下面是我创建output表的代码:

^{pr2}$

UNCONVENTIONAL是事实表产品类别的第一个条目。它是选择UNCONVENTIONAL作为我的列名而不是{}?如果是,那为什么呢?在

注:我是个新手,所以如果是个愚蠢的疑问,请直说出来。在

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值