72 questions
1
vote
1
answer
112
views
How to modify the datatype of `id` column for table create using SQLObject
I am trying to create a table using SQLObject with the following schema
class PersonThree(SQLObject):
firstname = StringCol(length=50)
lastname = StringCol(length=50)
age = IntCol()
This ...
0
votes
1
answer
99
views
How to get the database row id in a SQLObject Python class method to mimic AddRemoveName
When creating a table with SQLObject, it generates a primary key ID that is not in the Class definition ( ex Person and Address)
This ID must be used to point to a related table ( foreign key)
As far ...
1
vote
1
answer
84
views
Print SQL generated by SQLObject
from sqlobject import *
class Data(SQLObject):
ts = TimeCol()
val = FloatCol()
Data.select().count()
Fails with:
AttributeError: No connection has been defined for this thread or process
...
1
vote
2
answers
250
views
Mocking sqlobject function call for test db
I am trying to mock sqlbuilder.func for test cases with pytest
I successfully mocked sqlbuilder.func.TO_BASE64 with correct output but when I tried mocking sqlbuilder.func.FROM_UNIXTIME I didn't get ...
1
vote
1
answer
144
views
How to construct sql query with bitwise operation using sqlobject ORM in python3?
I am trying to create a query in python3 using sqlobject mapper. I have a requirement of filtering a custom field based on the output of bitise operation.
Query looks like this:
query = sqlobject.AND(...
0
votes
1
answer
78
views
How to do following sql operation using Table.select() method in python sqlobject?
Sql Operation:
SELECT *,
CASE
WHEN quota_unit = 'MB' THEN quota*1024
ELSE quota
END AS data_usage
FROM mapping
ORDER BY data_usage;
I tried like ...
2
votes
1
answer
249
views
Filter "value in list" with SQLObject ORM
I wanted to use SQLObject to allow my co-workers to get some data from my MySQL database. Now I need to use filter "value in list" but I don't know how can I do that.
I choosed SQLObject because it ...
1
vote
2
answers
173
views
trying to add data and query a mysql database using sqlobject and python 3
My code is raising an exception as shown below. I am pretty sure the problem is with my definition of the table relationship. I have tried multiple alternatives that give varying errors :-(
I have ...
1
vote
1
answer
67
views
python3 with SQLObject class pass parameters
I am new to python3 and tring to build a sqlobject class which named whatever. Then I created a function to caculate the average of one column. Here are parts of the codes.
class whatever(sqlobject....
2
votes
1
answer
353
views
Possible to get a generator over a custom SQLObject Select call?
I'm using the SQLObject ORM in Python, and I want to be able to iterate over a generator (of the row objects) in the same way I would Table.select(...), but what I can get from doing this method call ...
2
votes
1
answer
338
views
SqlObject and SqlBuilder IN() function with string values
as my first post here, I would like to warn that I looked as well as I could on the web but nothing that solved it.
I am using python 2.7 and latest version of sqlobject lib.
I faced that when ...
2
votes
1
answer
324
views
How to call queryAll method
I was going through the instructions specified under SQL statements, and I got stuck at this line:
rows = connection.queryAll(query)
From where are we getting this connection object? Because I am ...
1
vote
1
answer
152
views
ConnectionURI to connect to SQL Server in Python
I'm coding a little something in Python. I need to get some data from a MicrosoftSQL database and convert it to a JSONObject. And i think i have some problems with the ConnectionForURI. I'm using ...
2
votes
2
answers
114
views
SQLObject install without internet
Trying to setup a python flask server in a controlled environment, no access to internet
# python setup.py install
Traceback (most recent call last):
File "setup.py", line 9, in <module>
...
2
votes
1
answer
410
views
Python SQL Object selecting data by dictionary and date
I am using SQLObject, a wrapper for python to manage SQL Queries, with Python 2.7. I know I can select data by using a dictionary such as:
restrictions = { ... }
selection = sql_table.selectBy(**...