# What’s the migration path for ray.data.datasource.tfrecords\_datasource.TFRecordDatasource?

**URL:** <https://discuss.ray.io/t/what-s-the-migration-path-for-ray-data-datasource-tfrecords-datasource-tfrecorddatasource/21368>\
**Category:** Ray Data\
**Created:** [January 5, 2025, 1:15am UTC](https://discuss.ray.io/t/what-s-the-migration-path-for-ray-data-datasource-tfrecords-datasource-tfrecorddatasource/21368 "2025-01-05T01:15:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidxia](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/davidxia/32/2951_2.png) [@davidxia](https://discuss.ray.io/u/davidxia)\
**Post date:** [January 5, 2025, 1:15am UTC](https://discuss.ray.io/t/what-s-the-migration-path-for-ray-data-datasource-tfrecords-datasource-tfrecorddatasource/21368/1 "2025-01-05T01:15:51Z")

</div>

I was using `from ray.data.datasource.tfrecords_datasource import TFRecordDatasource` in ray 2.23.0. But after upgrading to 2.40.0, this class was moved to `ray.data._internal.datasource.tfrecords_datasource.TFRecordDatasource` from [this change](https://github.com/ray-project/ray/pull/46171).

similar to [What's the migration path for ray.data.aggregate's Max, Mean, Min, and Std functions?](https://discuss.ray.io/t/whats-the-migration-path-for-ray-data-aggregates-max-mean-min-and-std-functions/21366/1)

---

<div class="post-metadata">

**Author:** ![rliaw](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/rliaw/32/24_2.png) [@rliaw](https://discuss.ray.io/u/rliaw)\
**Post date:** [March 6, 2025, 10:49pm UTC](https://discuss.ray.io/t/what-s-the-migration-path-for-ray-data-datasource-tfrecords-datasource-tfrecorddatasource/21368/2 "2025-03-06T22:49:45Z")

</div>

@davidxia could you share your use case/why you need to import that? TFRecordDatasource, like our other data sources, is supposed to be a private implementation.

We recommend just maintaining a separate version, or figuring out how we can support your changes to TFRecordDatasource if you’ve made extensions.

---

<div class="post-metadata">

**Author:** ![davidxia](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/davidxia/32/2951_2.png) [@davidxia](https://discuss.ray.io/u/davidxia)\
**Post date:** [March 10, 2025, 7:04pm UTC](https://discuss.ray.io/t/what-s-the-migration-path-for-ray-data-datasource-tfrecords-datasource-tfrecorddatasource/21368/3 "2025-03-10T19:04:42Z")

</div>

We were using when it was public but alpha in 2.23.0. It was [privatized here](https://github.com/ray-project/ray/pull/46171/files#diff-9d628d90039025fb559945855019cefac89439c7f1a588bf2ba95b47656eb242L49). We’ve since stopped using the class directly. I think we were using it before it had the `tfx-bsl` performance improvement.

Now we use `ray.data.read_tfrecords(tfx_read_options=...)`. Using the `tfx_read_options` parameter which will read TFRecords with `tfx-bsl` which is faster.
