UNPKG

dataframe-js

Version:

Immutable and functional data structure for datascientists and developpers

174 lines (100 loc) 4.07 kB
<!-- Generated by documentation.js. Update this documentation by updating the source code. --> ### Table of Contents - [SQL][1] - [register][2] - [request][3] - [dropTables][4] - [dropTable][5] - [renameTable][6] - [listTables][7] - [registerTable][8] ## SQL [src/modules/sql/index.js:12-109][9] SQL module for DataFrame, providing SQL-like syntax for data exploration in DataFrames. **Parameters** - `df` **DataFrame** An instance of DataFrame. ### register [src/modules/sql/index.js:105-108][10] Register the DataFrame as temporary table. **Parameters** - `tableName` **[String][11]** The name of the table. - `overwrite` **[Boolean][12]** Overwrite if the table already exists. (optional, default `false`) **Examples** ```javascript df.sql.register('tmp'); ``` ### request [src/modules/sql/index.js:20-24][13] Request on a SQL query. **Parameters** - `query` **[String][11]** A SQL query to request. **Examples** ```javascript DataFrame.request('SELECT * FROM tmp'); ``` Returns **any** The result of the query. ### dropTables [src/modules/sql/index.js:31-33][14] Drop or remove all registered tables. **Examples** ```javascript DataFrame.dropTables(); ``` ### dropTable [src/modules/sql/index.js:41-43][15] Drop or remove a registered table. **Parameters** - `tableName` **[String][11]** The registered table to drop. **Examples** ```javascript DataFrame.dropTable('tmp1'); ``` ### renameTable [src/modules/sql/index.js:53-56][16] Rename a registered table. **Parameters** - `tableName` **[String][11]** The registered table to rename. - `replacement` **[String][11]** The new table name. - `overwrite` **[Boolean][12]** Overwrite if the table already exists. (optional, default `false`) **Examples** ```javascript DataFrame.renameTable('tmp1', 'notTmp1'); ``` ### listTables [src/modules/sql/index.js:64-66][17] List all registered tables. **Examples** ```javascript DataFrame.listTables(); ``` Returns **[Array][18]** A list of the registered tables. ### registerTable [src/modules/sql/index.js:76-87][19] Register a DataFrame as a temporary table. **Parameters** - `df` **DataFrame** The DataFrame to register. - `tableName` **[String][11]** The temporary table name. - `overwrite` **[Boolean][12]** Overwrite if the table already exists. (optional, default `false`) **Examples** ```javascript DataFrame.registerTable('tmp', df); ``` [1]: #sql [2]: #register [3]: #request [4]: #droptables [5]: #droptable [6]: #renametable [7]: #listtables [8]: #registertable [9]: https://github.com/Gmousse/dataframe-js/blob/cef738e8a8e82e94515dfc49f015f842a8c410f2/src/modules/sql/index.js#L12-L109 "Source code on GitHub" [10]: https://github.com/Gmousse/dataframe-js/blob/cef738e8a8e82e94515dfc49f015f842a8c410f2/src/modules/sql/index.js#L105-L108 "Source code on GitHub" [11]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String [12]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean [13]: https://github.com/Gmousse/dataframe-js/blob/cef738e8a8e82e94515dfc49f015f842a8c410f2/src/modules/sql/index.js#L20-L24 "Source code on GitHub" [14]: https://github.com/Gmousse/dataframe-js/blob/cef738e8a8e82e94515dfc49f015f842a8c410f2/src/modules/sql/index.js#L31-L33 "Source code on GitHub" [15]: https://github.com/Gmousse/dataframe-js/blob/cef738e8a8e82e94515dfc49f015f842a8c410f2/src/modules/sql/index.js#L41-L43 "Source code on GitHub" [16]: https://github.com/Gmousse/dataframe-js/blob/cef738e8a8e82e94515dfc49f015f842a8c410f2/src/modules/sql/index.js#L53-L56 "Source code on GitHub" [17]: https://github.com/Gmousse/dataframe-js/blob/cef738e8a8e82e94515dfc49f015f842a8c410f2/src/modules/sql/index.js#L64-L66 "Source code on GitHub" [18]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array [19]: https://github.com/Gmousse/dataframe-js/blob/cef738e8a8e82e94515dfc49f015f842a8c410f2/src/modules/sql/index.js#L76-L87 "Source code on GitHub"