Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python ON DUPLICATE KEY UPDATE

# key-values werden erkannt -> Daten werden überschrieben 
# key-values = symbol, time -> der Rest wird überschrieben...
insertRates = "INSERT INTO Rates ( symbol, time, open, high, low, close, " 
insertRates += "tick_volume, spread, real_volume ) VALUES "
insertRates += "( %s, %s, %s, %s, %s, %s, %s, %s, %s ) " 
insertRates += "ON DUPLICATE KEY UPDATE "
insertRates += "open = VALUES( open ), high = VALUES( high ), "
insertRates += "low = VALUES( low ), close = VALUES( close ) , "
insertRates += "tick_volume = VALUES( tick_volume ), spread = VALUES( spread), "
insertRates += "real_volume = VALUES( real_volume ); "
 
PREVIOUS NEXT
Tagged: #python #ON #DUPLICATE #KEY #UPDATE
ADD COMMENT
Topic
Name
6+3 =