Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
550 B
1
Indexable
Never
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}'"
    columns_to_update.append(f"{column_name} = {update_value}")