1111# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212# See the License for the specific language governing permissions and
1313# limitations under the License.
14- from typing import Optional , Callable , TYPE_CHECKING
14+ from typing import Optional , Callable , Any , TYPE_CHECKING
1515from dataclasses import dataclass
1616
1717from satellite ._log import logger
1818from satellite ._fake import fake
1919
20-
2120if TYPE_CHECKING :
2221 from satellite ._tables import Table
2322
@@ -54,6 +53,7 @@ def sql_type(self) -> str:
5453 "double" : "real" ,
5554 "localdate" : "date" ,
5655 "byte[]" : "bytea" ,
56+ "double[]" : "real[]" ,
5757 }
5858
5959 if self .java_type .lower () in java_to_sql_type_map :
@@ -65,16 +65,17 @@ def sql_type(self) -> str:
6565 )
6666 return "text"
6767
68- @property
69- def format_specifier (self ) -> str :
68+ def sql_marshal (self , value : Any ) -> str :
7069 if self .sql_type == "text" :
71- return "'%s '"
70+ return f"' { value } '"
7271 elif self .sql_type == "timestamptz" or self .sql_type == "date" :
73- return "timestamp '%s '"
72+ return f "timestamp '{ value } '"
7473 elif self .sql_type == "bytea" :
75- return "E'%s'"
74+ return f"E'{ value } '"
75+ elif self .sql_type == "real[]" :
76+ return f"ARRAY { str (value )} "
7677
77- return "%s"
78+ return str ( value )
7879
7980 @property
8081 def is_foreign_key (self ) -> bool :
@@ -114,5 +115,5 @@ def faker_method(self) -> Callable:
114115 return getattr (fake , self .sql_type )
115116
116117 else :
117- logger .error (f"Have no provider for { self .sql_type } " )
118+ logger .error (f"Have no provider for { self .sql_type } in column { self . name } " )
118119 return fake .default
0 commit comments