{"cells": [{"cell_type": "markdown", "metadata": {}, "source": ["# Magic commands about files\n", "\n", "Use of magic commands implemented by *pyensae*."]}, {"cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": ["%load_ext pyensae\n", "from pyensae.sql import Database"]}, {"cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [{"data": {"text/html": ["
\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
directorylast_modifiednamesize
0False2016-11-09 23:35:42.656229.\\azure_blob_storage.ipynb33.91 Kb
1False2016-11-09 23:35:42.667238.\\example_corrplot.ipynb203.16 Kb
2False2016-11-09 23:35:42.683248.\\example_of_ssh_client_communication.ipynb199.06 Kb
3False2016-11-09 23:35:42.695257.\\folium_map.ipynb17.60 Kb
4False2017-01-07 18:38:26.725089.\\magic_commands_about_files.ipynb15.37 Kb
5False2016-12-28 23:04:00.646329.\\pyensae_flat2db3.ipynb72.66 Kb
6False2016-12-28 23:04:00.681589.\\pyensae_sql_magic.ipynb71.64 Kb
7False2016-11-09 23:35:42.728279.\\pyensae_StockPrices.ipynb488.76 Kb
8False2016-12-28 23:04:00.747517.\\pyensae_text2table.ipynb25.68 Kb
9False2016-11-09 23:35:42.770842.\\pyensae_velib.ipynb300.54 Kb
10False2016-11-09 23:35:42.778852.\\python_hadoop_pig.ipynb57.73 Kb
11False2016-11-09 23:35:42.784856.\\using_qgrid_with_jsdf.ipynb6.71 Kb
12False2016-12-28 23:04:00.827547.\\view_differences.ipynb49.39 Kb
13False2016-12-28 23:04:00.838553.\\.ipynb_checkpoints\\magic_commands_about_file...26.17 Kb
14False2016-12-28 23:04:00.915596.\\.ipynb_checkpoints\\pyensae_flat2db3-checkpoi...72.66 Kb
15False2016-12-28 23:04:00.931221.\\.ipynb_checkpoints\\pyensae_sql_magic-checkpo...71.64 Kb
16False2016-12-28 23:04:00.961358.\\.ipynb_checkpoints\\pyensae_text2table-checkp...25.68 Kb
17False2016-12-28 23:04:00.984509.\\.ipynb_checkpoints\\view_differences-checkpoi...49.39 Kb
\n", "
"], "text/plain": [" directory last_modified \\\n", "0 False 2016-11-09 23:35:42.656229 \n", "1 False 2016-11-09 23:35:42.667238 \n", "2 False 2016-11-09 23:35:42.683248 \n", "3 False 2016-11-09 23:35:42.695257 \n", "4 False 2017-01-07 18:38:26.725089 \n", "5 False 2016-12-28 23:04:00.646329 \n", "6 False 2016-12-28 23:04:00.681589 \n", "7 False 2016-11-09 23:35:42.728279 \n", "8 False 2016-12-28 23:04:00.747517 \n", "9 False 2016-11-09 23:35:42.770842 \n", "10 False 2016-11-09 23:35:42.778852 \n", "11 False 2016-11-09 23:35:42.784856 \n", "12 False 2016-12-28 23:04:00.827547 \n", "13 False 2016-12-28 23:04:00.838553 \n", "14 False 2016-12-28 23:04:00.915596 \n", "15 False 2016-12-28 23:04:00.931221 \n", "16 False 2016-12-28 23:04:00.961358 \n", "17 False 2016-12-28 23:04:00.984509 \n", "\n", " name size \n", "0 .\\azure_blob_storage.ipynb 33.91 Kb \n", "1 .\\example_corrplot.ipynb 203.16 Kb \n", "2 .\\example_of_ssh_client_communication.ipynb 199.06 Kb \n", "3 .\\folium_map.ipynb 17.60 Kb \n", "4 .\\magic_commands_about_files.ipynb 15.37 Kb \n", "5 .\\pyensae_flat2db3.ipynb 72.66 Kb \n", "6 .\\pyensae_sql_magic.ipynb 71.64 Kb \n", "7 .\\pyensae_StockPrices.ipynb 488.76 Kb \n", "8 .\\pyensae_text2table.ipynb 25.68 Kb \n", "9 .\\pyensae_velib.ipynb 300.54 Kb \n", "10 .\\python_hadoop_pig.ipynb 57.73 Kb \n", "11 .\\using_qgrid_with_jsdf.ipynb 6.71 Kb \n", "12 .\\view_differences.ipynb 49.39 Kb \n", "13 .\\.ipynb_checkpoints\\magic_commands_about_file... 26.17 Kb \n", "14 .\\.ipynb_checkpoints\\pyensae_flat2db3-checkpoi... 72.66 Kb \n", "15 .\\.ipynb_checkpoints\\pyensae_sql_magic-checkpo... 71.64 Kb \n", "16 .\\.ipynb_checkpoints\\pyensae_text2table-checkp... 25.68 Kb \n", "17 .\\.ipynb_checkpoints\\view_differences-checkpoi... 49.39 Kb "]}, "execution_count": 3, "metadata": {}, "output_type": "execute_result"}], "source": ["%lsr .*[.]ipynb"]}, {"cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [{"name": "stdout", "output_type": "stream", "text": ["usage: head [-h] [-n N] [-r] [-e ENCODING] [-s ERRORS] f\n", "\n", "display the first lines of a text file\n", "\n", "positional arguments:\n", " f filename\n", "\n", "optional arguments:\n", " -h, --help show this help message and exit\n", " -n N, --n N number of lines to display\n", " -r, --raw display raw text instead of HTML\n", " -e ENCODING, --encoding ENCODING\n", " file encoding\n", " -s ERRORS, --errors ERRORS\n", " What about errors: \"\", strict, replace,\n", " surrogateescape, xmlcharrefreplace, backslashreplace,\n", " namereplace\n", "usage: head [-h] [-n N] [-r] [-e ENCODING] [-s ERRORS] f\n", "\n"]}], "source": ["%head --help"]}, {"cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [{"data": {"text/html": ["\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
\n", "

constructor

\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
param dbfile:
 

database file (use :memory: to avoid creating a file and using only memory)\n", "it can also contain several files separated by ;:

\n", "
name_file ; nickname,second_file ; ...\n", "
\n", "
\n", "
param engine:
 

SQLite or MySQL (if it is installed)

\n", "
param user:
 

user if needed

\n", "
param password:
 

password if needed

\n", "
param host:
 

to connect to a MSSQL database

\n", "
param LOG:

LOG function

\n", "
param attach:
 

dictionary: { nickname: filename }, list of database to attach

\n", "
\n", "
\n", "

Warning

\n", "

If the folder does not exist, it will be created

\n", "
\n", "

\n", "
\n", "\n", "\n"], "text/plain": [""]}, "execution_count": 5, "metadata": {}, "output_type": "execute_result"}], "source": ["%hhelp Database.__init__"]}, {"cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [{"name": "stdout", "output_type": "stream", "text": ["\n", " constructor\n", "\n", " @param dbfile database file (use ``:memory:`` to avoid creating a file and using only memory)\n", " it can also contain several files separated by ;\n", " @code\n", " name_file ; nickname,second_file ; ...\n", " @endcode\n", " @param engine SQLite or MySQL (if it is installed)\n", " @param user user if needed\n", " @param password password if needed\n", " @param host to connect to a MSSQL database\n", " @param LOG LOG function\n", " @param attach dictionary: { nickname: filename }, list of database to attach\n", "\n", " @warning If the folder does not exist, it will be created\n", " \n"]}], "source": ["%hhelp -f text Database.__init__"]}, {"cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [{"data": {"text/plain": ["\"{'confidence': 1.0, 'encoding': 'ascii'}\""]}, "execution_count": 7, "metadata": {}, "output_type": "execute_result"}], "source": ["%encoding pyensae_sql_magic.ipynb"]}, {"cell_type": "code", "execution_count": 7, "metadata": {"collapsed": true}, "outputs": [], "source": []}], "metadata": {"kernelspec": {"display_name": "Python 3", "language": "python", "name": "python3"}, "language_info": {"codemirror_mode": {"name": "ipython", "version": 3}, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.1"}}, "nbformat": 4, "nbformat_minor": 2}