Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
245 views

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 ...
willshen's user avatar
2 votes
1 answer
71 views

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 ...
filograndipad2's user avatar
-1 votes
1 answer
1k views

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 ...
FeoJun's user avatar
  • 153
0 votes
1 answer
1k views

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....
FeoJun's user avatar
  • 153
3 votes
0 answers
53 views

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,...
bbayles's user avatar
  • 4,557
0 votes
1 answer
533 views

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 ...
Nir Elbaz's user avatar
  • 636
0 votes
1 answer
1k views

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 ...
Angelo van Meurs's user avatar
1 vote
4 answers
8k views

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 ...
Le Hoang Phuc's user avatar
0 votes
1 answer
544 views

link da questão Briefly, I want to know what this "DB-API" mechanism is. Are there multiple DB-APIs (there are more than 1 DB-API)? Is it just a 'rules' document? have a source code? What ...
user avatar
2 votes
0 answers
310 views

I'll admit it. I've been doing this for literally decades: sql = 'select * from whatever where key = "%s"' % ('thing') cursor.execute(sql) One big reason is that print(sql) tells me ...
drysdam's user avatar
  • 8,677
1 vote
1 answer
2k views

According to documentation, parameters needed to connect to HANA database are host, port, user and password. from hdbcli import dbapi conn = dbapi.connect( address="<hostname>", ...
nimish .v.shinde's user avatar
3 votes
1 answer
81 views

I have the following PostgreSQL database table: TABLE session_monitor ( id int, customer_name varchar(150) ) When I am running the following code: seq = pg_cur.execute("SELECT id ,...
dani shamir's user avatar
0 votes
1 answer
262 views

I am going to execute 2 sql queries and I want to put them in a transaction, if any query failed then call rollback(). The code is shown as following and 2 queries are str_trunction: truncate the ...
user2894829's user avatar
1 vote
1 answer
2k views

Python code is taking around 2-3 secs to make the snowflake database connection. Is it expected behaviour ? OR are there any parameters which will speed up connection time. Here is the sample code: ...
SunilS's user avatar
  • 2,328
0 votes
0 answers
405 views

I have build an application (python3.6) which keeps checking a directory for incoming files and when there are files it spawns some python processes in order to work on those files.This work involves ...
Varun Maurya's user avatar
1 vote
1 answer
2k views

I must be a moron, because I cannot figure out how to ask SQLAlchemy to perform a simple, non-lazy inner join. In other words, return all the results in a single query. The raw SQL query I would like ...
ExactaBox's user avatar
  • 3,425
2 votes
2 answers
8k views

After successfully installing the HDBCLI driver and connecting SAP HANA with Python, I created the below code to test the connection, however, I got an error: Error: (-10719, "Connect failed (invalid ...
LearningHero's user avatar
10 votes
2 answers
7k views

I'm trying to catch mysql/sqlalchemy OperationalErrors and replace handle access denied (1045) differently from connection refused (2003) sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError)...
Gamification's user avatar
0 votes
1 answer
1k views

I'm working with postgresql using the Python DB API. The substring expression I'm using works fine when on its own, but when I put it in the context of a join command I get a syntax error, and I can'...
topplethepat's user avatar
-2 votes
2 answers
3k views

The following SQLite query returns 3: SELECT MAX(depth) FROM mpitree WHERE child = 2 But this code evaluates to None: def ancestors_depth(self): self.cursor.execute("SELECT MAX(depth) FROM ...
N.J.'s user avatar
  • 37
0 votes
0 answers
267 views

import dbapi2 conn = dbapi2.connect("db", autocommit=True) def fetch_generator(): cursor = conn.cursor() for res in cursor.execute('select * from table'): yield res def generator_1():...
Jason's user avatar
  • 2,180
3 votes
1 answer
5k views

I want to connect to remote oracle db using python. Tried to using cx_Oracle. Here is my code: import cx_Oracle adr = 'server_addres' uid = 'user_id' pwd = 'pwd' port = 'port' cx_Oracle.connect(...
user avatar
3 votes
1 answer
1k views

I need to create a simple project in Flask. I don't want to use SQLAlchemy. In the code snippet below, everyone that connects to the server uses the same connection object but for each request, a new ...
amone's user avatar
  • 3,892
0 votes
1 answer
842 views

I'm trying to learn to add backend to a simple web app using postgreSQL and Python DB-API. When running the app, why do I get an error if the function get_posts() in forumdb. python uses c. execute ("...
day's user avatar
  • 63
0 votes
1 answer
74 views

Currently learning data science with SQLite and Pandas. Working on a political contributions dataset. I'm wondering what is the purpose of WHERE contributors.candidate_id = candidates.id in the code ...
daytony's user avatar
  • 438