TechScholar Hub
03/06/2024, 7:01 PMUsageError: An error happened while creating the connection: type object 'ClickHouseDialect_http' has no attribute 'dbapi'.
Perhaps you meant to use the 'clickhouse' db
To find more information regarding connection: <https://jupysql.ploomber.io/en/latest/integrations/clickhouse.html>
To fix it:
Pass a valid connection string:
Example: %sql <postgresql://username:password@hostname/dbname>
For more details, see: <https://jupysql.ploomber.io/en/latest/connecting.html>
Nadira Shoketayeva
03/28/2024, 8:33 AM--with=transform_types,recrafts,image_types
--with transform_types --with recrafts --with image_types
--with transform_types,recrafts,image_types
Nadira Shoketayeva
04/10/2024, 7:34 PMRuntimeError: Orig exception: Code: 394. DB::Exception: Query was cancelled. (QUERY_WAS_CANCELLED) (version 23.8.11.28 (official build))
If you need help solving this issue, send us a message: <https://ploomber.io/community>
Martin Jones
05/01/2024, 10:13 AM%%sql
LOAD DATA LOCAL INFILE 'penguins.csv'
INTO TABLE PENGUIN (
SPECIES, ISLAND, BILL_LENGTH, BILL_DEPTH, FLIPPER_LENGTH,
BODY_MASS, SEX, YEAR
)
and getting
RuntimeError: (pymysql.err.OperationalError) (3948, 'Loading local data is disabled; this must be enabled on both the client and server sides')
as far as I can tell it's enabled on the server:
%%sql
show global variables like 'local_infile';
Running query in '<mysql+pymysql://martin>:***@localhost/mysql'
1 rows affected.
Variable_name Value
local_infile ON
Wim Van Leuven
05/15/2024, 8:35 AMValueError: not enough values to unpack (expected 2, got 1)
... which brings me here...Paul Wilson
05/16/2024, 10:24 PMTommy
06/11/2024, 12:08 AMimport duckdb
%load_ext sql
%sql duckdb:///test.db
# %%
%%sql
DROP TABLE IF EXISTS test_data;
CREATE TABLE test_data AS SELECT * FROM read_csv_auto('/tmp/data.csv');
-- Below works when run within the notebook.
select count(*) from test_data;
However, when I open test.db afterwards, the table is not there. I tried wrapping the query inside BEGIN TRANSACTION
… COMMIT
but I get an error saying transactions are not supported. Is there anything specific I need to do to make sure the data saves?Jon Mellman
07/07/2024, 7:47 AM%%sql
cells in VSCode jupyter notebooks? I believe the syntax highlighting docs are for Jupyter Lab, and not VSCode. jupysql is working great, this is the one thing that’s kind of annoying 😕Andres Ladino
07/11/2024, 2:37 PMquery_template = """
SELECT
MONTH(created) AS month,
COUNT(*) AS row_count
FROM
{table_name}
GROUP BY
MONTH(created)
ORDER BY
month;
"""
m2m = []
for table in ("T1", "T2", "T3"):
query = query_template.format(table_name=table)
result = %sql {query}
m2m.append(result)
Tilman Schmiedeberg
07/25/2024, 12:05 PMTilman Schmiedeberg
07/25/2024, 12:05 PMMaheer Musa
09/03/2024, 8:05 PMMaheer Musa
09/03/2024, 8:05 PMMaheer Musa
09/03/2024, 8:05 PMRuntimeError: (sqlite3.OperationalError) no such column: building_structure.building_id
[SQL: SELECT *
FROM id_map AS i
JOIN building_structure AS s ON i.building_id=building_structure.building_id
WHERE district_id = 4
Limit 5]
(Background on this error at: <https://sqlalche.me/e/20/e3q8>)
If you need help solving this issue, send us a message: <https://ploomber.io/community>
Maheer Musa
09/03/2024, 8:06 PMCharles-Axel Dein
09/16/2024, 4:09 PMCatalog Error: Table with name df does not exist!
Eric Papaluca
10/30/2024, 9:51 AMEric Papaluca
11/05/2024, 3:26 PM%config SqlMagic.dsn_filename = "connections.ini"
is there a way to change this without using the magic?Eric Papaluca
11/05/2024, 3:27 PM/home/sagemaker-user/.jupysql/
gets trashed on first start-up so there's no way to have the file in there unless I use a lifecycle policy to symlink it at bootup, it would be easier if could just change the configEric Papaluca
11/05/2024, 3:54 PMipython_kernel_config.py
:
c.IPKernelApp.exec_lines = ["%config SqlMagic.dsn_filename = '/connections.ini'"]
Eric Papaluca
11/05/2024, 4:01 PM%load_ext sql
, which means it's always going to failIsrael okon
11/25/2024, 6:16 PMRuntimeError: (sqlite3.OperationalError) database is locked
[SQL: CREATE TABLE assessments (
AssessmentId INTEGER PRIMARY KEY AUTOINCREMENT,
year INTEGER,
Assessment_Officer VARCHAR(100),
Officer_Reg INTEGER,
water_level NUMERIC(10,1)
);]
(Background on this error at: <https://sqlalche.me/e/20/e3q8>)
"Please help me resolve this.Kha Nguyen
12/05/2024, 12:33 PM%load_ext sql
%config SqlMagic.autopolars = True
%config SqlMagic.feedback = False
%config SqlMagic.displaycon = False
conn = duckdb.connect()
%sql conn --alias duckdb
Now, I suppose that jupysql is using the defined connection. I also pass this connection to PyIceberg to load some tables
from pyiceberg.catalog import load_catalog
catalog = load_catalog(**credential)
catalog.load_table((namespace, "table")).scan().to_duckdb("table", conn)
Now, I can query this table using the conn
object, so this works
conn.sql("""
SELECT *
FROM table
LIMIT 1
""")
But this does not work, complaining that the table does not exist
%%sql
SELECT *
FROM table
LIMIT 1
Is there any way we can let jupysql work with the connection in conn
?Sanyun Lee
12/06/2024, 8:46 AM%%sql
doesn't support running PL/SQL block. Is there any plan to implement this?
%%sql
begin
dbms_session.sleep(5);
end;
2. Is it not possible to execute multiple statements in one cell one by one using %%sql
? Like the below:
%%sql
statement1;
statement2;
...
Thanks.Michael Baum
01/31/2025, 6:36 PMmichael shire
02/06/2025, 6:51 PMsales_data
that shows up in %sqlcmd tables
and I can query from it via %sql
but it says there is not table when i use %sqlcmd columns
even though it is listed right there in the Did you mean:
Anyone else encounter this?
edit: same problem when i try %sqlcmd profile
for exampleAkshay
02/10/2025, 4:16 PMAmaha Gebretsadikan
03/10/2025, 12:22 PMEric Papaluca
03/11/2025, 3:34 PM%%sql
CREATE EXTERNAL TABLE transformed_data.test_table4
PARTITIONED BY (year)
STORED AS parquet
LOCATION '<s3://foo-us-development/test_folder4>'
AS (
SELECT
'Bill'::varchar(100) as name,
2025 as year
);
INSERT INTO transformed_data.test_table2
(
SELECT
'Hello'::varchar(100),
2026
);
we receive the error:
ValueError: invalid literal for int() with base 10: b'INSERT'
yet the stack trace shows:
File /opt/conda/lib/python3.11/site-packages/redshift_connector/core.py:2109, in Connection.handle_COMMAND_COMPLETE(self, data, cursor)
2107 _logger.debug("command=%s", command)
2108 if command in self._commands_with_count:
-> 2109 row_count: int = int(values[-1])
2110 if cursor._row_count == -1:
2111 cursor._row_count = row_count
is this error in the redshift_connector or how in jupysql interprets the error?Eduardo