@@ -78,7 +78,7 @@ def _load_doc_to_row(
7878 doc : Document ,
7979 metadata_json_column : str ,
8080 parse_json : bool = True ,
81- ):
81+ ) -> tuple :
8282 """
8383 Load document to row.
8484
@@ -90,7 +90,7 @@ def _load_doc_to_row(
9090 JSON object is used to compare with Spanner reads.
9191 """
9292 doc_metadata = doc .metadata .copy ()
93- row = [doc . page_content ]
93+ row = []
9494 # store metadata
9595 for col in table_fields :
9696 if (
@@ -100,6 +100,8 @@ def _load_doc_to_row(
100100 ):
101101 row .append (doc_metadata [col ])
102102 del doc_metadata [col ]
103+ if col == CONTENT_COL_NAME :
104+ row .append (doc .page_content )
103105 if metadata_json_column in table_fields :
104106 metadata_json = {}
105107 if metadata_json_column in doc_metadata :
@@ -118,7 +120,7 @@ def _batch(datas: List[Any], size: int = 1) -> Iterator[List[Any]]:
118120
119121
120122class SpannerLoader (BaseLoader ):
121- """Loads data from Google CLoud Spanner."""
123+ """Loads data from Google Cloud Spanner."""
122124
123125 def __init__ (
124126 self ,
@@ -158,7 +160,7 @@ def __init__(
158160 self .metadata_json_column = metadata_json_column
159161 formats = ["JSON" , "text" , "YAML" , "CSV" ]
160162 if self .format not in formats :
161- raise Exception ("Use on of 'text', 'JSON', 'YAML', 'CSV'" )
163+ raise Exception ("Use one of 'text', 'JSON', 'YAML', 'CSV'" )
162164 self .databoost = databoost
163165 self .client = client
164166 self .staleness = staleness
0 commit comments