Untitled

 avatar
unknown
plain_text
2 years ago
625 B
3
Indexable
elif is_datetime(source_val):
    # Format datetime values using the appropriate function for the database type
    if db_type_ext == 'ORACLE':
        update_value = f"TO_DATE('{source_val}', 'YYYY-MM-DD HH24:MI:SS')"
    elif db_type_ext in ('MYSQL', 'MARIA'):
        # For MariaDB and MySQL, use STR_TO_DATE
        update_value = f"STR_TO_DATE('{source_val}', '%Y-%m-%d %H:%i:%s')"
    else:
        # Enclose other values in single quotes
        update_value = f"'{source_val}'"
    
    # Add the column name and formatted value to the update statement
    columns_to_update.append(f"{column_name} = {update_value}")
Editor is loading...