def import_chart(slc_to_import: Slice, slc_to_override: Optional[Slice], import_time: Optional[int]=None) -> int:
    'Inserts or overrides slc in the database.\n\n    remote_id and import_time fields in params_dict are set to track the\n    slice origin and ensure correct overrides for multiple imports.\n    Slice.perm is used to find the datasources and connect them.\n\n    :param Slice slc_to_import: Slice object to import\n    :param Slice slc_to_override: Slice to replace, id matches remote_id\n    :returns: The resulting id for the imported slice\n    :rtype: int\n    '
    session = db.session
    make_transient(slc_to_import)
    slc_to_import.dashboards = []
    slc_to_import.alter_params(remote_id=slc_to_import.id, import_time=import_time)
    slc_to_import = slc_to_import.copy()
    slc_to_import.reset_ownership()
    params = slc_to_import.params_dict
    datasource = ConnectorRegistry.get_datasource_by_name(session, slc_to_import.datasource_type, params['datasource_name'], params['schema'], params['database_name'])
    slc_to_import.datasource_id = datasource.id
    if slc_to_override:
        slc_to_override.override(slc_to_import)
        session.flush()
        return slc_to_override.id
    session.add(slc_to_import)
    logger.info('Final slice: %s', str(slc_to_import.to_json()))
    session.flush()
    return slc_to_import.id
Inserts or overrides slc in the database.

remote_id and import_time fields in params_dict are set to track the
slice origin and ensure correct overrides for multiple imports.
Slice.perm is used to find the datasources and connect them.

:param Slice slc_to_import: Slice object to import
:param Slice slc_to_override: Slice to replace, id matches remote_id
:returns: The resulting id for the imported slice
:rtype: int
def import_chart(slc_to_import: Slice, slc_to_override: Optional[Slice], import_time: Optional[int]=None) -> int:
    'Inserts or overrides slc in the database.\n\n    remote_id and import_time fields in params_dict are set to track the\n    slice origin and ensure correct overrides for multiple imports.\n    Slice.perm is used to find the datasources and connect them.\n\n    :param Slice slc_to_import: Slice object to import\n    :param Slice slc_to_override: Slice to replace, id matches remote_id\n    :returns: The resulting id for the imported slice\n    :rtype: int\n    '
    session = db.session
    make_transient(slc_to_import)
    slc_to_import.dashboards = []
    slc_to_import.alter_params(remote_id=slc_to_import.id, import_time=import_time)
    slc_to_import = slc_to_import.copy()
    slc_to_import.reset_ownership()
    params = slc_to_import.params_dict
    datasource = ConnectorRegistry.get_datasource_by_name(session, slc_to_import.datasource_type, params['datasource_name'], params['schema'], params['database_name'])
    slc_to_import.datasource_id = datasource.id
    if slc_to_override:
        slc_to_override.override(slc_to_import)
        session.flush()
        return slc_to_override.id
    session.add(slc_to_import)
    logger.info('Final slice: %s', str(slc_to_import.to_json()))
    session.flush()
    return slc_to_import.id