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

Public Member Functions

def test_sql_validate
 

Detailed Description

Definition at line 266 of file test_integration.py.

Member Function Documentation

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

Definition at line 267 of file test_integration.py.

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

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