> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/connectors/other/mariadb-jupyter-kernel/using-the-kernel/sql-autocompletion-and-introspection.md).

# SQL Autocompletion and Introspection

These features are the result of Xing-Zhi Jiang's work during [Google Summer of Code 2021](https://summerofcode.withgoogle.com/archive/2021/projects/6374646231859200/) and they are being fine-tuned and improved constantly to get a decent code completion and introspection experience in the MariaDB Jupyter Kernel.

## Autocompletion

The MariaDB Jupyter kernel is able to provide SQL autocompletion with a basic internal understanding of the context within your statements. We are trying to make the suggestions as precise as possible, but any SQL autocompletion is imperfect unless you either duplicate the entire grammar logic of MariaDB Server or the MariaDB Server itself develops mechanisms for external tools to poke into its parsing logic.

Autocompletion in Jupyter can be triggered with the key `TAB`. In the classic Juptyter Notebook interface, it's possible to install some extensions to enable continuous hinting, but at the time this article is written there is no mechanism to enable continuous hinting in the new JupyterLab interface.

Here's a summary of our autocompletion capabilities, but we strongly recommend you play with the feature yourself and discover what it can do.

**SQL keywords and functions completion**

![](/files/LELUiku3WpHld1Jll1iq)

**Completion of database names in `USE` statements**

![](/files/yQUgkD6F2t8ymE51c1hj)

**Completion of database names in constructs like `database_to_autocomplete.table_name`**

![](/files/5hZLB8EbD2Jwx40vrm2k)

**Completion of table names in constructs like `db.table_name_to_autocomplete`**

![](/files/2GwDxPBYH4HFiWdMDfgp)

**Completion of column names in the `WHERE` clause**

![](/files/ZtGl2FtgW8kp6UlYm2II)

**Completion of column names in `SELECT` queries**

![](/files/PSVfL463yjAHbBtvhNDp)

**Completion of column names in `INSERT` statements**

![](/files/GIIGCTSCcXa0YkluMlQx)

**Resolving aliases and completion of column names in constructs like `alias.column_to_autocomplete`**

![](/files/xApmpjOhMVtEjzh9Fd7l)

**Completion of `SHOW` statements**

![](/files/BGQ3GEMeteK4BpT5YM9E)

**Completion of user accounts**

![](/files/6LIdnwrlMh0WCTyVfLgP)

**Completion of global and session variables**

![](/files/o8KaZNUFmzt0irlVTyf4)

## Introspection

Code introspection in Jupyter can be triggered with the `SHIFT-TAB` combination.\
This feature was designed to help you understand your database environment faster whilst typing SQL statements, for instance checking the table schema by inspecting on the table name before selecting a bunch of columns, or even checking the documentation of a SQL function to see the function signature and some practical examples and spare you an extra search on [MariaDB Documentation](https://github.com/mariadb-corporation/mariadb-docs/blob/main/connectors/other/mariadb-jupyter-kernel/using-the-kernel/broken-reference/README.md).

Although we tried to make introspection look exactly the same in both classic Jupyter Notebook and Jupyterlab interfaces, it wasn't possible due to some fundamental difference in how Notebook renders the introspection tooltip in comparison to the newer JupyterLab interface.\
For the moment, to see the full introspection information in Notebook that the MariaDB kernel sends to the frontend, you'll need to hit `shift-tab` then click on the expand button from the tooltip to get the `HTML` representation of the introspection information.

Here's a visual summary of our currently supported introspection capabilities.

**Database introspection**

![](/files/ItTenZp5A3c960ODt3Yp)

**Table schema and data summary**

![](/files/1UH6lxI3AHRuXmhShjLM)

**Column datatype and sample data**

![](/files/K6MkM0Z5yKiBbS2teLYB)

**SQL function documentation and examples**

![](/files/7rNN7eOB9c7Kn3CTvUza)

**User accounts introspection**

![](/files/dzlYE1Okeqvov3yNKp20)

{% @marketo/form formId="4316" %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://mariadb.com/docs/connectors/other/mariadb-jupyter-kernel/using-the-kernel/sql-autocompletion-and-introspection.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
