Export utils
tablite.export_utils
Classes
Functions
tablite.export_utils.to_sql(table, name)
generates ANSI-92 compliant SQL.
PARAMETER | DESCRIPTION |
---|---|
name |
name of SQL table.
TYPE:
|
Source code in tablite/export_utils.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
|
tablite.export_utils.to_pandas(table)
returns pandas.DataFrame
Source code in tablite/export_utils.py
51 52 53 54 55 56 57 58 59 60 |
|
tablite.export_utils.to_hdf5(table, path)
creates a copy of the table as hdf5
Note that some loss of type information is to be expected in columns of mixed type:
t.show(dtype=True) +===+===+=====+=====+====+=====+=====+===================+==========+========+===============+===+=========================+=====+===+ | # | A | B | C | D | E | F | G | H | I | J | K | L | M | O | |row|int|mixed|float|str |mixed| bool| datetime | date | time | timedelta |str| int |float|int| +---+---+-----+-----+----+-----+-----+-------------------+----------+--------+---------------+---+-------------------------+-----+---+ | 0 | -1|None | -1.1| |None |False|2023-06-09 09:12:06|2023-06-09|09:12:06| 1 day, 0:00:00|b |-100000000000000000000000| inf| 11| | 1 | 1| 1| 1.1|1000|1 | True|2023-06-09 09:12:06|2023-06-09|09:12:06|2 days, 0:06:40|嗨 | 100000000000000000000000| -inf|-11| +===+===+=====+=====+====+=====+=====+===================+==========+========+===============+===+=========================+=====+===+ t.to_hdf5(filename) t2 = Table.from_hdf5(filename) t2.show(dtype=True) +===+===+=====+=====+=====+=====+=====+===================+===================+========+===============+===+=========================+=====+===+ | # | A | B | C | D | E | F | G | H | I | J | K | L | M | O | |row|int|mixed|float|mixed|mixed| bool| datetime | datetime | time | str |str| int |float|int| +---+---+-----+-----+-----+-----+-----+-------------------+-------------------+--------+---------------+---+-------------------------+-----+---+ | 0 | -1|None | -1.1|None |None |False|2023-06-09 09:12:06|2023-06-09 00:00:00|09:12:06|1 day, 0:00:00 |b |-100000000000000000000000| inf| 11| | 1 | 1| 1| 1.1| 1000| 1| True|2023-06-09 09:12:06|2023-06-09 00:00:00|09:12:06|2 days, 0:06:40|嗨 | 100000000000000000000000| -inf|-11| +===+===+=====+=====+=====+=====+=====+===================+===================+========+===============+===+=========================+=====+===+
Source code in tablite/export_utils.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
|
tablite.export_utils.excel_writer(table, path)
writer for excel files.
This can create xlsx files beyond Excels. If you're using pyexcel to read the data, you'll see the data is there. If you're using Excel, Excel will stop loading after 1,048,576 rows.
See pyexcel for more details: http://docs.pyexcel.org/
Source code in tablite/export_utils.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
|
tablite.export_utils.to_json(table, *args, **kwargs)
Source code in tablite/export_utils.py
139 140 141 142 143 |
|
tablite.export_utils.path_suffix_check(path, kind)
Source code in tablite/export_utils.py
146 147 148 149 150 |
|
tablite.export_utils.text_writer(table, path, tqdm=_tqdm)
exports table to csv, tsv or txt dependening on path suffix. follows the JSON norm. text escape is ON for all strings.
Note:
If the delimiter is present in a string when the string is exported, text-escape is required, as the format otherwise is corrupted. When the file is being written, it is unknown whether any string in a column contrains the delimiter. As text escaping the few strings that may contain the delimiter would lead to an assymmetric format, the safer guess is to text escape all strings.
Source code in tablite/export_utils.py
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
|
tablite.export_utils.sql_writer(table, path)
Source code in tablite/export_utils.py
190 191 192 193 194 |
|
tablite.export_utils.json_writer(table, path)
Source code in tablite/export_utils.py
197 198 199 200 201 |
|
tablite.export_utils.to_html(table, path)
Source code in tablite/export_utils.py
204 205 206 207 208 |
|