我正在尝试将库存屏幕存储在sqlite数据库中,但是当我从pandas使用screen.to_sql()时它会返回:
Error: near "/": syntax error
如果我用'over'替换所有斜杠,那么我得到以下内容:
Error: unrecognized token: "]"
我很困惑,因为这段代码几乎与我用于mysql数据库的代码相同,有谁能看出为什么sqlite不喜欢这个?
这是由pandas创建的完整查询。
CREATE TABLE raw_screens (
[Company_Name] TEXT,
[Ticker] TEXT,
[%_Ratio_of_Q1/prior_Yr_Q1_Actual_Q(-3)] TEXT,
[Price/Book] TEXT,
[Price/Sales] TEXT
[Current_ROE_(TTM)] TEXT,
[Current_ROI_(TTM)] TEXT,
[ROI_(5_Yr_Avg)] TEXT,
[Current_ROA_(TTM)] TEXT,
[ROA_(5_Yr_Avg)] TEXT,
[Market_Value/#_Analysts] TEXT,
[Annual_Sales] TEXT,
[Cost_of_Goods_Sold] TEXT,
[EBITDA_] TEXT,
[Price/Cash_Flow] TEXT,
[PEG_Ratio] TEXT,
[P/E_(F2)] TEXT,
[%_Ratio_of_Q1/Q0] TEXT,
[This_Yr`s_Est.d_Growth_(F(1)/F(0))] TEXT,
[Last_Yrs_Growth_(F[0]_/_F_[-1])] TEXT,
[%_Change_EPS_(F(-1)/F(-2))] TEXT,
[Long-Term_Growth_Consensus_Est.] TEXT,
[5_Yr._Hist._EPS_Growth] TEXT,
[Sales_Growth_F(0)/F(-1)] TEXT,
[5_Yr_Historical_Sales_Growth] TEXT,
[F(1)_Consensus_Sales_Est._(Mil.)] TEXT,
[Q(1)_Consensus_Sales_Est._(Mil.)] TEXT,
[P/E_(Trailing_12_Months)] TEXT,
[EBIT_] TEXT,
[Pretax_Income_] TEXT,
[Preferred_Equity] TEXT,
[Current_Liabilities_] TEXT,
[Long_Term_Debt_] TEXT,
[Current_Assets_] TEXT,
[Intangibles] TEXT,
[Inventory_] TEXT,
[Receivables_] TEXT,
[Debt/Total_Capital] TEXT,
[Debt/Equity_Ratio] TEXT,
[Current_Ratio] TEXT,
[Quick_Ratio] TEXT,
[Book_Value] TEXT,
[Asset_Utilization] TEXT,
[Inventory_Turnover] TEXT,
[Net_Income_] TEXT,
[Cash_Flow_] TEXT,
[Net_Income_Growth_F(0)/F(-1)] TEXT,
[12_Mo._Net_Income_Current/Last_%] TEXT,
[12_Mo._Net_Income_Current-1Q/Last-1Q_%] TEXT,
[5_Yr_Div._Yield_%] TEXT,
[5_Yr_Hist._Div._Growth_%] TEXT,
[Dividend_] TEXT,
[Net_Margin] TEXT,
[Operating_Margin_12_Mo] TEXT,
[Turnover] TEXT,
[Cash_Ratio] TEXT,
[Rank_in_Industry_(of_ABR)] TEXT,
[%_Price_Change_(YTD)] TEXT,
[%_Price_Change_(4_Weeks)] TEXT,
[%_Price_Change_(1_Week)] TEXT,
[Beta] TEXT,
[Price_as_a_%_of_52_Wk_H-L_Range] TEXT,
[Last_Close] TEXT,
[Current_Avg_Broker_Rec] TEXT,
[%_Rating_Strong_Buy_or_Buy] TEXT,
[%_Rating_Strong_Sell_or_Sell] TEXT,
[Industry_Rank_(of_ABR)] TEXT,
[52_Week_Low] TEXT,
[%_Price_Change_(12_Weeks)] TEXT,
[Relative_Price_Change] TEXT,
[Q0_Consensus_Est._(last_completed_fiscal_Qtr)] TEXT,
[52_Week_High] TEXT,
[Market_Cap_] TEXT,
[Last_EPS_Surprise_(%)] TEXT,
[P/E_(F1)] TEXT,
[%_Rating_Change_-_4_Weeks] TEXT,
[%_Change_F1_Est._(4_weeks)] TEXT,
[Div._Yield_%] TEXT,
[Avg_Volume] TEXT,
[Shares_Outstanding_] TEXT,
[Change_in_Avg_Rec_] TEXT,
[%_Rating_Hold] TEXT,
[%_Change_Q2_Est._(4_weeks)] TEXT,
[%_Change_Q1_Est._(4_weeks)] TEXT,
[%_Change_F2_Est._(4_weeks)] TEXT,
[%_Change_LT_Growth_Est._(4_weeks)] TEXT,
[Q1_Consensus_Est._] TEXT,
[St._Dev._Q1_/_Q1_Consensus] TEXT,
[Q2_Consensus_Est._(next_fiscal_Qtr)] TEXT,
[St._Dev._Q2_/_Q2_Consensus] TEXT,
[F0_Consensus_Est.] TEXT,
[F1_Consensus_Est.] TEXT,
[St._Dev._F1_/_F1_Consensus] TEXT,
[%_Change_Q0_Est._(4_weeks)] TEXT,
[12_Mo_Trailing_EPS] TEXT,
[Last_Reported_Fiscal_Yr_] INTEGER,
[%_Rating_Upgrades_] TEXT,
[%_Rating_Downgrades_] TEXT,
[Common_Equity] TEXT,
[Average_Target_Price] TEXT,
[Previous_EPS_Surprise_(%)] TEXT,
[Avg_EPS_Surprise_(Last_4_Qtrs)] TEXT,
[Actual_EPS_used_in_Surprise_($/sh)] TEXT,
[Last_Qtr_EPS] TEXT,
[Last_Reported_Qtr_] TEXT,
[Last_Yr's_EPS_(F0)_Before_NRI] TEXT,
[F2_Consensus_Est.] TEXT,
[Date] TEXT
);
答案 0 :(得分:1)
[]
引号无法嵌套。
您应该使用可以转义的引号字符,例如"
(必须加倍):
...,
"my silly name" TEXT,
"my even ""sillier"" name with quotes" TEXT,
...
(在这种情况下,名称中甚至没有"
。)