Skip to content
Menu
HE'S BLOG
  • Home
  • One Page
  • Home page
  • Links
  • Mac
  • Windows
  • Program
  • AI
HE'S BLOG
2025年2月11日2025年2月11日

VS CODE + ipython-sql use SQL in jupyter

pip install ipython-sql

In jupyter file:
%reload_ext sql

%sql oracle://RDF_CN_Q321:password@localhost:8521/xe

%config SqlMagic.style = '_DEPRECATED_DEFAULT'
if no config , will got below errors:
KeyError                                  Traceback (most recent call last)
Cell In[9], line 1
----> 1 get_ipython().run_cell_magic('sql', '', 'select * from TABLE1\n')

File c:\Users\heeeeguo\AppData\Local\miniforge3\lib\site-packages\IPython\core\interactiveshell.py:2541, in InteractiveShell.run_cell_magic(self, magic_name, line, cell)
   2539 with self.builtin_trap:
   2540     args = (magic_arg_s, cell)
-> 2541     result = fn(*args, **kwargs)
   2543 # The code below prevents the output from being displayed
   2544 # when using magics with decorator @output_can_be_silenced
   2545 # when the last Python token in the expression is a ';'.
   2546 if getattr(fn, magic.MAGIC_OUTPUT_CAN_BE_SILENCED, False):

File c:\Users\heeeeguo\AppData\Local\miniforge3\lib\site-packages\sql\magic.py:219, in SqlMagic.execute(self, line, cell, local_ns)
    216     return
    218 try:
--> 219     result = sql.run.run(conn, parsed["sql"], self, user_ns)
    221     if (
    222         result is not None
    223         and not isinstance(result, str)
   (...)
    226         # Instead of returning values, set variables directly in the
    227         # user's namespace. Variable names given by column names
    229         if self.autopandas:
...
--> 116     self.pretty = PrettyTable(self.field_names, style=prettytable.__dict__[config.style.upper()])
    117 else:
    118     list.__init__(self, [])

KeyError: 'DEFAULT'
Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings...

%%sql

select * from TABLE1

output :

column1
111

近期文章

  • Dify1.3.1安装
  • Gopro 驱动下载
  • Popular models download website
  • Stable diffusion enable remote access
  • Ollama remote access

近期评论

    归档

    • 2025 年 5 月
    • 2025 年 3 月
    • 2025 年 2 月
    • 2024 年 3 月
    • 2023 年 10 月
    • 2023 年 5 月
    • 2023 年 4 月
    • 2022 年 11 月
    • 2022 年 9 月
    • 2022 年 5 月
    • 2022 年 4 月
    • 2022 年 3 月
    • 2022 年 2 月
    • 2022 年 1 月
    • 2021 年 10 月
    • 2021 年 9 月
    • 2021 年 5 月
    • 2020 年 7 月
    • 2020 年 6 月
    • 2020 年 5 月
    • 2020 年 4 月
    • 2020 年 3 月
    • 2019 年 11 月
    • 2019 年 10 月
    • 2018 年 9 月
    • 2018 年 6 月
    • 2018 年 5 月
    • 2018 年 2 月
    • 2017 年 8 月
    • 2016 年 4 月

    分类

    • AI
    • Android
    • Angular
    • Apple Hardware
    • C++
    • Docker
    • Doctine
    • ELK
    • English
    • Hadoop
    • Hbase
    • IDE&Tools
    • Ionic2
    • Javascript
    • jQuery
    • Kubernetes
    • Mac
    • PHP
    • Program
    • Scala
    • Shell
    • SQL
    • Symfony
    • Web
    • Wordpress
    • 一行命令

    其他操作

    • 登录
    • 条目 feed
    • 评论 feed
    • WordPress.org
    ©2025 HE'S BLOG | Powered by WordPress and Superb Themes!