File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020import google .cloud .bigquery
2121import pandas as pd
2222
23+ import bigframes .core .col as col
2324import bigframes .core .logging .log_adapter as log_adapter
2425import bigframes .core .sql .ml
2526import bigframes .dataframe as dataframe
2627import bigframes .ml .base
2728import bigframes .session
28- import bigframes .core .col as col
2929from bigframes .bigquery ._operations import utils
3030
3131
Original file line number Diff line number Diff line change @@ -353,6 +353,16 @@ def _struct_fields(self) -> List[str]:
353353 struct_type = typing .cast (pa .StructType , self ._dtype .pyarrow_dtype )
354354 return [struct_type .field (i ).name for i in range (struct_type .num_fields )]
355355
356+ @property
357+ def sql (self ) -> str :
358+ """Compiles this Series's expression tree to SQL.
359+
360+ Returns:
361+ A string representing the compiled SQL.
362+ """
363+
364+ return self .to_frame ().sql
365+
356366 @validations .requires_ordering ()
357367 def transpose (self ) -> Series :
358368 return self
Original file line number Diff line number Diff line change @@ -4999,3 +4999,9 @@ def test_series_item_with_empty(session):
49994999
50005000 with pytest .raises (ValueError , match = re .escape (expected_message )):
50015001 bf_s_empty .item ()
5002+
5003+
5004+ def test_series_sql (session ):
5005+ s = bigframes .pandas .Series ([], session = session )
5006+
5007+ assert len (s .sql ) > 0
You can’t perform that action at this time.
0 commit comments