Commit a64a5713 by 江名洋

chore(gitignore): 更新日志与临时文件忽略规则

1 parent aedd2700
...@@ -21,10 +21,12 @@ env/ ...@@ -21,10 +21,12 @@ env/
*~ *~
# Logs # Logs
logs/*.log logs/
*.log
# Temporary / upload files # Temporary / upload files
temp_uploads/ temp_uploads/
~$*
# OS # OS
.DS_Store .DS_Store
......
import pymysql
from app.core.config import settings
c = pymysql.connect(host=settings.DB_HOST, port=settings.DB_PORT,
user=settings.DB_USER, password=settings.DB_PASSWORD,
database=settings.DB_NAME, charset='utf8mb4')
cur = c.cursor()
for t in ['ods_goods_order', 'ods_goods_sub_order', 'ods_goods_order_customer']:
cur.execute(f"SHOW COLUMNS FROM {t}")
cols = [r[0] for r in cur.fetchall()]
print(f"\n{t} ({len(cols)} cols):")
for col in cols:
print(f" {col}")
c.close()
No preview for this file type
import pymysql
from app.core.config import settings
from app.services.etl_service import ETLService
conn = ETLService.get_target_conn()
cur = conn.cursor()
table_name = 'dws_order_detail_wide'
print(f"Truncating {table_name}...")
cur.execute(f"TRUNCATE TABLE `{table_name}`")
conn.commit()
print(f"Inserting data into {table_name}...")
sql = ETLService._get_sql_order_detail_wide(None, None)
affected = cur.execute(sql)
conn.commit()
print(f"Done: {affected} rows inserted into {table_name}")
cur.execute(f"SELECT COUNT(*) cnt, MIN(install_date) min_d, MAX(install_date) max_d FROM `{table_name}`")
r = cur.fetchone()
print(f" Verify: {r['cnt']} rows, {r['min_d']} ~ {r['max_d']}")
cur.close()
conn.close()
16:58:35 ERROR Analysis generate failed: name 'touch' is not defined [endpoints.py:272]
Traceback (most recent call last):
File "D:\work1\data-analyze-webui\app\api\endpoints.py", line 256, in analysis_generate
output_path = AnalysisService.build_report(
store_df, factory_sheets,
start_date=start_date or None,
end_date=end_date or None
)
File "D:\work1\data-analyze-webui\app\services\analysis_service.py", line 493, in build_report
AnalysisService._write_data_rows(ws, store_df, factory_sheets, db_perf,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
start_date, end_date)
^^^^^^^^^^^^^^^^^^^^^
File "D:\work1\data-analyze-webui\app\services\analysis_service.py", line 652, in _write_data_rows
touch_safe = _safe_float(touch, 0)
^^^^^
NameError: name 'touch' is not defined
File mode changed
14:00:52 ERROR [X] DWS Sync failed for task_id=manual_dws_sync: (1054, "Unknown column 'report_date' in 'where clause'") [etl_service.py:326]
Traceback (most recent call last):
File "D:\work1\data-analyze-webui\app\services\etl_service.py", line 291, in run_dw_sync
cur.execute(f"DELETE FROM `{table_name}` WHERE report_date BETWEEN %s AND %s", (start_date, end_date))
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python313\Lib\site-packages\pymysql\cursors.py", line 157, in execute
result = self._query(query)
File "D:\Python313\Lib\site-packages\pymysql\cursors.py", line 328, in _query
conn.query(q)
~~~~~~~~~~^^^
File "D:\Python313\Lib\site-packages\pymysql\connections.py", line 575, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python313\Lib\site-packages\pymysql\connections.py", line 826, in _read_query_result
result.read()
~~~~~~~~~~~^^
File "D:\Python313\Lib\site-packages\pymysql\connections.py", line 1203, in read
first_packet = self.connection._read_packet()
File "D:\Python313\Lib\site-packages\pymysql\connections.py", line 782, in _read_packet
packet.raise_for_error()
~~~~~~~~~~~~~~~~~~~~~~^^
File "D:\Python313\Lib\site-packages\pymysql\protocol.py", line 219, in raise_for_error
err.raise_mysql_exception(self._data)
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
File "D:\Python313\Lib\site-packages\pymysql\err.py", line 150, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.OperationalError: (1054, "Unknown column 'report_date' in 'where clause'")
14:07:54 ERROR [X] ODS Sync failed for task_id=manual_ods_sync: (1048, "Column 'merchant_id' cannot be null") [etl_service.py:220]
Traceback (most recent call last):
File "D:\work1\data-analyze-webui\app\services\etl_service.py", line 177, in run_ods_sync
cur.executemany(upsert_sql, data_tuples)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python313\Lib\site-packages\pymysql\cursors.py", line 186, in executemany
return self._do_execute_many(
~~~~~~~~~~~~~~~~~~~~~^
q_prefix,
^^^^^^^^^
...<4 lines>...
self._get_db().encoding,
^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "D:\Python313\Lib\site-packages\pymysql\cursors.py", line 219, in _do_execute_many
rows += self.execute(sql + postfix)
~~~~~~~~~~~~^^^^^^^^^^^^^^^
File "D:\Python313\Lib\site-packages\pymysql\cursors.py", line 157, in execute
result = self._query(query)
File "D:\Python313\Lib\site-packages\pymysql\cursors.py", line 328, in _query
conn.query(q)
~~~~~~~~~~^^^
File "D:\Python313\Lib\site-packages\pymysql\connections.py", line 575, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python313\Lib\site-packages\pymysql\connections.py", line 826, in _read_query_result
result.read()
~~~~~~~~~~~^^
File "D:\Python313\Lib\site-packages\pymysql\connections.py", line 1203, in read
first_packet = self.connection._read_packet()
File "D:\Python313\Lib\site-packages\pymysql\connections.py", line 782, in _read_packet
packet.raise_for_error()
~~~~~~~~~~~~~~~~~~~~~~^^
File "D:\Python313\Lib\site-packages\pymysql\protocol.py", line 219, in raise_for_error
err.raise_mysql_exception(self._data)
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
File "D:\Python313\Lib\site-packages\pymysql\err.py", line 150, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.IntegrityError: (1048, "Column 'merchant_id' cannot be null")
14:49:20 ERROR Failed to call LLM for schema analysis: [llm_service.py:90]
14:50:21 ERROR Failed to call LLM for schema analysis: [llm_service.py:90]
14:50:21 ERROR Failed to process dynamic upload: Object of type datetime is not JSON serializable [excel_service.py:105]
Traceback (most recent call last):
File "D:\work1\data-analyze-webui\app\services\excel_service.py", line 73, in process_dynamic_upload
schema = await LLMService.analyze_excel_schema(sheet, headers_raw, sample_data_raw, upload_type)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\work1\data-analyze-webui\app\services\llm_service.py", line 31, in analyze_excel_schema
原始表头 (可能包含多行): {json.dumps(headers, ensure_ascii=False)}
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python313\Lib\json\__init__.py", line 242, in dumps
**kw).encode(obj)
~~~~~~^^^^^
File "D:\Python313\Lib\json\encoder.py", line 202, in encode
chunks = self.iterencode(o, _one_shot=True)
File "D:\Python313\Lib\json\encoder.py", line 263, in iterencode
return _iterencode(o, 0)
File "D:\Python313\Lib\json\encoder.py", line 182, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
f'is not JSON serializable')
TypeError: Object of type datetime is not JSON serializable
16:58:33 ERROR Failed to query store info from DB: (1146, "Table 'data_analyze.dj_car_life_scene_merchant_ref' doesn't exist") [analysis_service.py:421]
Traceback (most recent call last):
File "D:\work1\data-analyze-webui\app\services\analysis_service.py", line 399, in _query_store_info
cur.execute(sql, (*store_names,))
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python313\Lib\site-packages\pymysql\cursors.py", line 157, in execute
result = self._query(query)
File "D:\Python313\Lib\site-packages\pymysql\cursors.py", line 328, in _query
conn.query(q)
~~~~~~~~~~^^^
File "D:\Python313\Lib\site-packages\pymysql\connections.py", line 575, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python313\Lib\site-packages\pymysql\connections.py", line 826, in _read_query_result
result.read()
~~~~~~~~~~~^^
File "D:\Python313\Lib\site-packages\pymysql\connections.py", line 1203, in read
first_packet = self.connection._read_packet()
File "D:\Python313\Lib\site-packages\pymysql\connections.py", line 782, in _read_packet
packet.raise_for_error()
~~~~~~~~~~~~~~~~~~~~~~^^
File "D:\Python313\Lib\site-packages\pymysql\protocol.py", line 219, in raise_for_error
err.raise_mysql_exception(self._data)
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
File "D:\Python313\Lib\site-packages\pymysql\err.py", line 150, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.ProgrammingError: (1146, "Table 'data_analyze.dj_car_life_scene_merchant_ref' doesn't exist")
16:58:35 ERROR Analysis generate failed: name 'touch' is not defined [endpoints.py:272]
Traceback (most recent call last):
File "D:\work1\data-analyze-webui\app\api\endpoints.py", line 256, in analysis_generate
output_path = AnalysisService.build_report(
store_df, factory_sheets,
start_date=start_date or None,
end_date=end_date or None
)
File "D:\work1\data-analyze-webui\app\services\analysis_service.py", line 493, in build_report
AnalysisService._write_data_rows(ws, store_df, factory_sheets, db_perf,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
start_date, end_date)
^^^^^^^^^^^^^^^^^^^^^
File "D:\work1\data-analyze-webui\app\services\analysis_service.py", line 652, in _write_data_rows
touch_safe = _safe_float(touch, 0)
^^^^^
NameError: name 'touch' is not defined
18:16:26 ERROR Failed to query store performance from DB: (1054, "Unknown column 'sence_type' in 'where clause'") [analysis_service.py:354]
Traceback (most recent call last):
File "D:\work1\data-analyze-webui\app\services\analysis_service.py", line 321, in _query_store_performance
cur.execute(sql, params)
~~~~~~~~~~~^^^^^^^^^^^^^
File "D:\Python313\Lib\site-packages\pymysql\cursors.py", line 157, in execute
result = self._query(query)
File "D:\Python313\Lib\site-packages\pymysql\cursors.py", line 328, in _query
conn.query(q)
~~~~~~~~~~^^^
File "D:\Python313\Lib\site-packages\pymysql\connections.py", line 575, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python313\Lib\site-packages\pymysql\connections.py", line 826, in _read_query_result
result.read()
~~~~~~~~~~~^^
File "D:\Python313\Lib\site-packages\pymysql\connections.py", line 1203, in read
first_packet = self.connection._read_packet()
File "D:\Python313\Lib\site-packages\pymysql\connections.py", line 782, in _read_packet
packet.raise_for_error()
~~~~~~~~~~~~~~~~~~~~~~^^
File "D:\Python313\Lib\site-packages\pymysql\protocol.py", line 219, in raise_for_error
err.raise_mysql_exception(self._data)
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
File "D:\Python313\Lib\site-packages\pymysql\err.py", line 150, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.OperationalError: (1054, "Unknown column 'sence_type' in 'where clause'")
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!