136 questions
0
votes
0
answers
250
views
Use Jinja template for table name inside SQLExecuteQueryOperator params or parameter
I am using SQLExecuteQuery Operator to query a table, which name is dynamically generated (e.g. staging_{{ts_nodash}}).
I know I can, but I don't want to use the jinja template inside sql (example ...
2
votes
2
answers
1k
views
Efficient SQL query with pandas using databricks-sql-python
Databricks allows to make SQL queries via an API using the databricks-sql-python package.
There are then two ways of creating a connection object that can be put into a pd.read_sql_query(sql, con=...
2
votes
1
answer
72
views
Connection and cursor still usable outside with block
My system:
Windows 10 x64
Python version 3.9.4
SQLite3 module integrated in the standard library
A DB connection and a cursor are both considered resources, so that I can use a with clause.
I know ...
1
vote
1
answer
436
views
Why do I get unexpected type when using None for Google BigQuery DB-API?
I'm trying to migrate data from a MySQL table to a BigQuery table using Python, but it gives me the following error when I try to insert a NULL value:
google.cloud.bigquery.dbapi.exceptions....
-1
votes
1
answer
1k
views
Can't catch connection error clickhouse-driver db api
I'm trying to catch a connection error when connecting to kx using the clickhouse-driver db api in python. But for some reason, the try: block passes without errors, and I don't get exception
def ...
1
vote
0
answers
254
views
Reveal the meaning of DBAPI error message dictionary keys
For a few months Ive been working with pg8000 and have noticed when it throws an error like dbapi.ProgrammingError, the message is followed by a dictionary with some keys and values. Where can I find ...
0
votes
1
answer
1k
views
How to catch exception clickhouse_driver dbapi?
I want to catch exception while executing scipts/connecting to base using clickhouse_driver-drive dbapi.
Can I catch errors codes and errors message like
errorcodes.lookup(e.pgcode)
and
e.diag....
0
votes
1
answer
2k
views
Pandas dataframe to SQL table using presto-python-client syntax error: mismatched input ';'
I am connecting to a presto db, trying to write a dataframe into a sql table. I can "CREATE TABLE" but df.to_sql throws a syntax error:
PrestoUserError: PrestoUserError(type=USER_ERROR, name=...
3
votes
0
answers
53
views
Python's sqlite3 module: get query with escaped parameters [duplicate]
The sqlite3 module allows one to use parameter substitution for queries like so:
import sqlite3
con = sqlite3.connect(":memory:")
cur = con.cursor()
cur.execute("create table lang (name,...
5
votes
1
answer
4k
views
How to fetch data from Clickhouse in dicitionary/name-tuple using clickhouse-driver (python)?
When we fetch data using the DB API 2.0 cur.execute("select * from db.table") we get a cursor which seems like a generator object of list of tuples.
Whereas in pymongo, when we fetch we get ...
0
votes
1
answer
536
views
How to preform insert into BigQuery table of list of values using dbapi
I have a question regarding performing insert into a table in BigQuery using the DBAPI .
The simple insert of 1 value I was able to preform , my question is how to preform insert of list of values.
I ...
0
votes
1
answer
673
views
OpenTelemetry Python Instrumentation dbapi is not capturing the odbc database commands
I am trying to capture the database commands using Instrumentation DBapi, but i don't see anything to be reported to Jaeger. I am accessing database using pyodbc and pandas and i see while debugging ...
0
votes
1
answer
2k
views
Why do sqlite3 DB_API qmark and named style not work in "select where" queries?
Assuming I have a database with table users with a row:
ID = 0, name = 'myName'
I can get the ID value (assuming I'm connected) by using either:
cursor.execute("""SELECT ID FROM users ...
0
votes
1
answer
961
views
How can I use elasticsearch-dbapi with Open Distro for ElasticSearch, ignoring SSL certificates?
How can I use elasticsearch-dbapi with Open Distro for Elasticsearch, ignoring ssl certificates?
I am using Open Distro for Elasticsearch 1.13.2, Python 3.7, elasticsearch client 7.12.1, sqlalchemy: 1....
1
vote
4
answers
8k
views
IBM Db2 : An unexpected token "as" was found following "SELECT test_score " (SQL0104N)
I am now having trouble with IBM Db2 using queries. I have a code below:
test_score_distribution = %sql SELECT test_score as "Test Score", count(*) as "Frequency" from ...