OmniSciDB  ba1bac9284
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
tests.test_integration.TestExtras Class Reference

Public Member Functions

def test_sql_validate
 

Detailed Description

Definition at line 268 of file test_integration.py.

Member Function Documentation

def tests.test_integration.TestExtras.test_sql_validate (   self,
  con 
)

Definition at line 269 of file test_integration.py.

270  def test_sql_validate(self, con):
271  from omnisci.common.ttypes import TTypeInfo
272 
273  c = con.cursor()
274  c.execute('drop table if exists stocks;')
275  create = (
276  'create table stocks (date_ text, trans text, symbol text, '
277  'qty int, price float, vol float);'
278  )
279  c.execute(create)
280 
281  q = "select * from stocks"
282  results = con._client.sql_validate(con._session, q)
283  col_names = sorted([r.col_name for r in results])
284  col_types = [r.col_type for r in results]
285 
286  expected_col_names = [
287  'date_',
288  'price',
289  'qty',
290  'symbol',
291  'trans',
292  'vol',
293  ]
294 
295  expected_types = [
296  TTypeInfo(
297  type=6,
298  encoding=4,
299  nullable=True,
300  is_array=False,
301  precision=0,
302  scale=0,
303  comp_param=32,
304  size=-1,
305  ),
306  TTypeInfo(
307  type=6,
308  encoding=4,
309  nullable=True,
310  is_array=False,
311  precision=0,
312  scale=0,
313  comp_param=32,
314  size=-1,
315  ),
316  TTypeInfo(
317  type=6,
318  encoding=4,
319  nullable=True,
320  is_array=False,
321  precision=0,
322  scale=0,
323  comp_param=32,
324  size=-1,
325  ),
326  TTypeInfo(
327  type=1,
328  encoding=0,
329  nullable=True,
330  is_array=False,
331  precision=0,
332  scale=0,
333  comp_param=0,
334  size=-1,
335  ),
336  TTypeInfo(
337  type=3,
338  encoding=0,
339  nullable=True,
340  is_array=False,
341  precision=0,
342  scale=0,
343  comp_param=0,
344  size=-1,
345  ),
346  TTypeInfo(
347  type=3,
348  encoding=0,
349  nullable=True,
350  is_array=False,
351  precision=0,
352  scale=0,
353  comp_param=0,
354  size=-1,
355  ),
356  ]
357 
358  assert col_types == expected_types
359  assert col_names == expected_col_names

The documentation for this class was generated from the following file: