merge and kill task fixes
This commit is contained in:
@@ -206,11 +206,11 @@ class DuckDBStorage:
|
||||
|
||||
# Insert data directly into DuckDB (ignore duplicates)
|
||||
# Note: id column is auto-generated, so we don't include it
|
||||
# Using INSERT OR IGNORE for better DuckDB compatibility
|
||||
self.conn.execute("""
|
||||
INSERT INTO ohlcv_data (symbol, timeframe, timestamp, open, high, low, close, volume, created_at)
|
||||
INSERT OR IGNORE INTO ohlcv_data (symbol, timeframe, timestamp, open, high, low, close, volume, created_at)
|
||||
SELECT symbol, timeframe, timestamp, open, high, low, close, volume, created_at
|
||||
FROM df_insert
|
||||
ON CONFLICT DO NOTHING
|
||||
""")
|
||||
|
||||
# Update metadata
|
||||
@@ -223,7 +223,11 @@ class DuckDBStorage:
|
||||
WHERE symbol = ? AND timeframe = ?
|
||||
""", (symbol, timeframe)).fetchone()
|
||||
|
||||
first_ts, last_ts, count = result
|
||||
# Handle case where no data exists yet
|
||||
if result is None or result[0] is None:
|
||||
first_ts, last_ts, count = 0, 0, 0
|
||||
else:
|
||||
first_ts, last_ts, count = result
|
||||
now_ts = int(datetime.now().timestamp() * 1000)
|
||||
|
||||
self.conn.execute("""
|
||||
|
||||
Reference in New Issue
Block a user