tablesample.to_sql

In [ ]:
tablesample.to_sql()

Generates the SQL query associated to the tablesample.

Returns

str : SQL query associated to the tablesample.

Example

In [15]:
from verticapy.utilities import *
dataset = tablesample(values = {"index": ["region", "price", "quality"],
                                "Banana": ["Brazil", 2.3, 2],
                                "Manguo": ["Columbia", 6.7, 5],
                                "Apple": ["France", 1.5, 2]},)
display(dataset)
Banana
Manguo
Apple
regionBrazilColumbiaFrance
price2.36.71.5
quality252
Rows: 1-3 | Columns: 4
In [17]:
print(dataset.to_sql())
(SELECT 'region' AS "index", 'Brazil' AS "Banana", 'Columbia' AS "Manguo", 'France' AS "Apple") UNION ALL (SELECT 'price' AS "index", 2.3 AS "Banana", 6.7 AS "Manguo", 1.5 AS "Apple") UNION ALL (SELECT 'quality' AS "index", 2 AS "Banana", 5 AS "Manguo", 2 AS "Apple")