modify scripts
This commit is contained in:
@ -90,13 +90,12 @@ def fetch_reports_list_general(fetch_func, table_name, s_date, e_date, data_dir_
|
||||
row['stockName'] = ''
|
||||
if 'stockCode' not in row or row['stockCode'] is None or row['stockCode']=='':
|
||||
row['stockCode'] = ''
|
||||
if 'newPeIssueA' in row and row['newPeIssueA'] is None:
|
||||
if 'newPeIssueA' in row:
|
||||
try:
|
||||
row['newPeIssueA'] = float(row.get('newPeIssueA', 0))
|
||||
except ValueError:
|
||||
row['newPeIssueA'] = 0.0
|
||||
else:
|
||||
row['newPeIssueA'] = 0.0
|
||||
|
||||
row_id = db_tools.insert_or_update_common(row, table_name)
|
||||
if row_id:
|
||||
logging.debug(f'insert one row. rowid:{row_id}, ')
|
||||
|
||||
@ -0,0 +1,40 @@
|
||||
"""Auto update from stockdb
|
||||
|
||||
Revision ID: ed6f0c9504d3
|
||||
Revises: c72bb1f27166
|
||||
Create Date: 2025-08-10 19:30:35.563839
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import mysql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = 'ed6f0c9504d3'
|
||||
down_revision: Union[str, Sequence[str], None] = 'c72bb1f27166'
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
"""Upgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column('reports_stock', 'ratingChange',
|
||||
existing_type=mysql.INTEGER(),
|
||||
type_=sa.String(length=50),
|
||||
existing_comment='评级变动',
|
||||
existing_nullable=True)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column('reports_stock', 'ratingChange',
|
||||
existing_type=sa.String(length=50),
|
||||
type_=mysql.INTEGER(),
|
||||
existing_comment='评级变动',
|
||||
existing_nullable=True)
|
||||
# ### end Alembic commands ###
|
||||
@ -484,7 +484,7 @@ class ReportsStock(Base):
|
||||
lastEmRatingCode: Mapped[Optional[str]] = mapped_column(String(50), comment="上次东方财富评级代码")
|
||||
lastEmRatingValue: Mapped[Optional[str]] = mapped_column(String(50), comment="上次东方财富评级值")
|
||||
lastEmRatingName: Mapped[Optional[str]] = mapped_column(String(100), comment="上次东方财富评级名称")
|
||||
ratingChange: Mapped[Optional[int]] = mapped_column(Integer, comment="评级变动")
|
||||
ratingChange: Mapped[Optional[str]] = mapped_column(String(50), comment="评级变动")
|
||||
reportType: Mapped[Optional[int]] = mapped_column(Integer, comment="报告类型")
|
||||
author: Mapped[Optional[str]] = mapped_column(String(255), comment="作者(逗号分隔)")
|
||||
indvIsNew: Mapped[Optional[str]] = mapped_column(String(20), comment="是否为新研报")
|
||||
|
||||
Reference in New Issue
Block a user