module sql.magic_sql
¶
Short summary¶
module pyensae.sql.magic_sql
Defines SQL commands to play with sqlite3. See notebook SQL Magic Commands with SQLite in a Notebook.
Classes¶
class |
truncated documentation |
---|---|
Defines SQL commands to play with sqlite3 See notebook SQL Magic Commands with SQLite in a Notebook. … |
Functions¶
function |
truncated documentation |
---|---|
register magics function, can be called from a notebook |
Properties¶
property |
truncated documentation |
---|---|
|
return the context or None |
|
A contextmanager for running a block with our cross validation lock set to True. At the end of the block, … |
Static Methods¶
staticmethod |
truncated documentation |
---|---|
defines the way to parse the magic command |
|
defines the way to parse the magic command |
|
defines the way to parse the magic command |
|
defines the way to parse the magic command |
|
defines the way to parse the magic command |
|
defines the way to parse the magic command |
|
defines the way to parse the magic command |
|
defines the way to parse the magic command |
|
defines the way to parse the magic command |
|
defines the way to parse the magic command |
Methods¶
method |
truncated documentation |
---|---|
returns the connection stored in the workspace |
|
defines command |
|
defines |
|
define |
|
define |
|
defines |
|
defines |
|
defines |
|
defines |
|
define |
|
define |
Documentation¶
Defines SQL commands to play with sqlite3. See notebook SQL Magic Commands with SQLite in a Notebook.
-
class
pyensae.sql.magic_sql.
MagicSQL
(**kwargs)[source]¶ Bases:
pyquickhelper.ipythonhelper.magic_class.MagicClassWithHelpers
Defines SQL commands to play with sqlite3 See notebook SQL Magic Commands with SQLite in a Notebook.
Create a configurable given a config config.
- configConfig
If this is empty, default values are used. If config is a
Config
instance, it will be used to configure the instance.- parentConfigurable instance, optional
The parent Configurable instance of this object.
Subclasses of Configurable must call the
__init__()
method ofConfigurable
before doing anything else and usingsuper()
:class MyConfigurable(Configurable): def __init__(self, config=None): super(MyConfigurable, self).__init__(config=config) # Then any other code you need to finish initialization.
This ensures that instances will be configured properly.
-
SQL
(line, cell=None)[source]¶ defines command
%%SQL
SQL
The code for magic command
%%SQL
is equivalent to:<variable> = db.execute(<cell>)
See notebook SQL Magic Commands with SQLite in a Notebook.
-
SQL_add_function
(line)[source]¶ defines
%SQL_add_function
which adds a function to the databaseSQL_add_function
The code for magic command
%SQL_add_function
is equivalent to:db.add_function(fu)
See notebook SQL Magic Commands with SQLite in a Notebook.
-
static
SQL_add_function_parser
()[source]¶ defines the way to parse the magic command
%SQL_add_function
-
SQL_close
(line='')[source]¶ define
SQL_close
which closes a databaseSQL_close
The code for magic command
%SQL_close
is equivalent to:db.close()
See notebook SQL Magic Commands with SQLite in a Notebook.
-
SQL_connect
(line)[source]¶ define
SQL_connect
which connects to a SQL database, it stores the database object in variable DB by defaultSQL_connect_parser
The code for magic command
%SQL_connect_parser
is equivalent to:from pyense.sql import InterfaceSQL obj = InterfaceSQL.create(args.filename) obj.connect()
See notebook SQL Magic Commands with SQLite in a Notebook.
-
SQL_drop_table
(line)[source]¶ defines
%SQL_drop_table
which drops a table from a databaseSQL_drop_table
The code for magic command
%SQL_drop_table
is equivalent to:db.drop_table()
See notebook SQL Magic Commands with SQLite in a Notebook.
-
SQL_import_df
(line)[source]¶ defines
%SQL_import_df
which imports a dataframe into a databaseSQL_import_df
The code for magic command
%SQL_import_df
is equivalent to:db.import_dataframe(<table>, <df>)
See notebook SQL Magic Commands with SQLite in a Notebook.
-
SQL_import_tsv
(line)[source]¶ defines
%SQL_import_tsv
whichs import a TSV file into a databaseSQL_import_tsv
The code for magic command
%SQL_import_tsv
is equivalent to:db.import_flat_file(<filename>, <table>)
See notebook SQL Magic Commands with SQLite in a Notebook.
-
static
SQL_refresh_completion_parser
()[source]¶ defines the way to parse the magic command
%SQL_refresh_completion
-
SQL_schema
(line='')[source]¶ define
SQL_schema
SQL_schema
The code for magic command
%SQL_schema
is equivalent to:db.get_table_columns(<table>, as_dict=not <as_list>)
See notebook SQL Magic Commands with SQLite in a Notebook.
-
SQL_tables
(line='')[source]¶ define
%SQL_tables
whichs lists the tables in a databaseSQL_tables
The code for magic command
%SQL_tables
is equivalent to:db.get_table_list()
See notebook SQL Magic Commands with SQLite in a Notebook.
-
_trait_default_generators
= {}¶