Django raw query cursor error - sql

The following code gives me an error
from django.db import connection
cursor = connection.cursor()
Error message:
Undefined variable from import: cursor
I have Django 1.2.5 installed. How can a resolve this issue?
Thanks

This was just a PyDev information message as Daniel pointed out. I am able to run the script without modifying anything.

Related

vba selenium waitDisplay method not working

Who can tell me why the method of Selenium WebDriver.WaitDisplayed is not working in my code below?
I can share other code if needed?
Set a = webdriber.FindElementsByClass("search-global-typeahead__collapsed-search-button")
a.Item(1).WaitDisplayed(True).Click ' operation timed out after -1ms. Run-time err'21'
a.Item(1).Click ' gives an error
I added code below; without successful result
a.Item(1).WaitDisplayed(True, 100).Until(a.Item(1).IsDisplayed,10)
I guess to start with the most obvious, does it still cause an error after fixing the typo in the 'webdriber' identifier? I'm guessing your declaration is spelled 'webdriver'.

readNetFromDarknet assertion error separator_index < line.size()

I am failing to use readNetFromDarknet function for the reasons I do not understand. I am trying to use yolo3-spp with this configuration file https://github.com/pjreddie/darknet/blob/master/cfg/yolov3-spp.cfg.
import cv2
net = cv2.dnn.readNetFromDarknet("../models/yolov3-spp.weights", "../models/yolov3-spp.cfg")
However, this gives me the following error:
error: OpenCV(4.5.4) /tmp/pip-req-build-3129w7z7/opencv/modules/dnn/src/darknet/darknet_io.cpp:660: error: (-215:Assertion failed) separator_index < line.size() in function 'ReadDarknetFromCfgStream
Interestingly, if I use readNet instead of readNetFromDarknet, it seems to work just fine. Should I stick to using readNet instead and why readNetFromDarknet is not actually working?
Your problem in order function arguments. readNetFromDarknet waits first config file and second - weights. A readNet function can swap arguments if they have a wrong order.
So right code:
net = cv2.dnn.readNetFromDarknet("../models/yolov3-spp.cfg", "../models/yolov3-spp.weights")

Vega-Embed giving build error Cannot find name 'Extract' and 'Exclude'

I created angular 6 application(Using node). In this application I used vega-embed. It is giving me compilation error.
import embed from 'vega-embed';
I also changed code in util.d.ts import stableStringify = require('json-stable-stringify') but giving following error
ERROR in node_modules/vega-lite/build/src/util.d.ts(58,41): error TS2304: Cannot find name 'Extract'.
node_modules/vega-lite/build/src/util.d.ts(73,58): error TS2304: Cannot find name 'Exclude'.
Please suggest.

FreeTDS ODBC error "The identifier that starts with ... is too long. Maximum length is 128."

I've been using pyodbc and free TDS to a submit queries to a microsoft SQL-2012 without issue for a while now but have recently stumbled on an issue.
When I submit a longer query I get an error message saying that one of the identifiers is too long and the script crashes.
The EXACT same query works in management studio and doesn't even return a warning.
I've added the following to my code with no avail.
SET QUOTED_IDENTIFIER OFF
SET ANSI_NULLS ON
The piece of code that the error is referring to is here:
(ZR_KOPF.ZRK_DDP_B IN ('190/TEMP.AA1H', '190/RAIN.AA1H', '190/WDR.AA1H', '190/WSP.AA1H', '190/SD1.AA1H', '190/HUMID.AA1H', '190/NO2.AA1H', '190/PM10.AA1H', '190/PM2.5.AA1H', '190/SO2.AA1H', '190/OZONE.AA1H', '190/CO.AA1H', '206/TEMP.AA1H', '206/RAIN.AA1H', '206/WDR.AA1H', '206/WSP.AA1H', '206/SD1.AA1H', '206/HUMID.AA1H', '206/NO2.AA1H', '206/PM10.AA1H', '206/PM2.5.AA1H', '206/SO2.AA1H', '206/OZONE.AA1H', '206/CO.AA1H')) AND ZR_KOPF.ZRK_BASEPRODUCTION = 1)
The error I get is:
pyodbc.ProgrammingError: ('42000', "[42000] [FreeTDS][SQL Server]The identifier that starts with ''190/TEMP.AA1H', '190/RAIN.AA1H', '190/WDR.AA1H', '190/WSP.AA1H', '190/SD1.AA1H', '190/HUMID.AA1H', '190/NO2.AA1H', '190/PM10.AA' is too long. Maximum length is 128. (103) (SQLExecDirectW)")
Pyodbc version: 4.0.18b1
freetds version: 1.00.48
Any help would be much appreciated
Cheers!
So turns out the spaces between each of the items in the list made all the difference...
I removed them and the query worked without a hitch.
Thanks for all the help everyone!

Error when connecting Hive with kibi?

I am using kibi-community-demo-full-4.6.4-linux-x64 version.
In datasource:
"connection_string": "jdbc:hive://localhost:10000/root",
"libpath": "/home/pare/Downloads/jar/",
"drivername": "org.apache.hadoop.hive.jdbc.HiveDriver",
"libs": "hive-jdbc-0.11.0.jar,hive-metastore-0.11.0.jar,libthrift-0.9.1.jar,hive-service-0.13.1.jar,hive-jdbc-1.2.1.2.3.2.0-2950-standalone.jar,hadoop-common-2.7.1.2.3.2.0-2950.jar",
After that when in queries I write a query it will show error like:
Queries Editor: Error 400 Bad Request: Error running static method java.lang.IllegalArgumentException: Bad URL format at org.apache.hive.jdbc.Utils.parseURL(Utils.java:185) at org.apache.hive.jdbc.HiveConnection.(HiveConnection.java:84)
What is the error can any one explain me how to solve it?
I am able to connect after changing the jars version.
and also I changed the driver name "org.apache.hive.jdbc.HiveDriver".