MCPcopy Create free account
hub / github.com/feast-dev/feast / read_sql

Method read_sql

sdk/python/feast/infra/ray_initializer.py:252–263  ·  view source on GitHub ↗

Read from a SQL database. Builds the connection factory from connection_url.

(self, sql: str, connection_url: str, **kwargs)

Source from the content-addressed store, hash-verified

250 )
251
252 def read_sql(self, sql: str, connection_url: str, **kwargs) -> Any:
253 """Read from a SQL database. Builds the connection factory from connection_url."""
254 import sqlalchemy
255
256 def _connection_factory():
257 # raw_connection() returns a DB API2-compliant connection (with .cursor())
258 # from the underlying driver. engine.connect() returns a SQLAlchemy 2.0
259 # Connection object which does NOT expose .cursor(), failing Ray Data's
260 # DB API2 compliance check.
261 return sqlalchemy.create_engine(connection_url).raw_connection()
262
263 return ray.data.read_sql(sql, _connection_factory, **kwargs)
264
265 def from_huggingface(
266 self, dataset_name: str, split: str = "train", **kwargs

Callers 5

_remoteMethod · 0.45
get_query_schemaFunction · 0.45
test_stored_writesMethod · 0.45

Calls

no outgoing calls

Tested by 2

test_stored_writesMethod · 0.36