Oleg Broytman | 15 May 13:55 2016
X-Face
Gravatar

SQLObject 3.0.0b1

Hello!

I'm pleased to announce version 3.0.0b1, the first beta of the upcoming
release of branch 3.0 of SQLObject.

What's new in SQLObject
=======================

Features
--------

* Support for Python 2 and Python 3 with one codebase!
  (Python version >= 3.4 currently required.)

Minor features
--------------

* PyDispatcher (>=2.0.4) was made an external dependency.

Development
-----------

* Source code was made flake8-clean.

Documentation
-------------

* Documentation is published at http://sqlobject.readthedocs.org/ in
  Sphinx format.

(Continue reading)

Oleg Broytman | 10 May 21:42 2016
X-Face
Gravatar

SQLObject 2.2.1

Hello!

I'm pleased to announce version 2.2.1, the first bugfix release of branch
2.2 of SQLObject.

What's new in SQLObject
=======================

* Fix a bug in sqlbuilder.CONCAT (inherit from SQLExpression).

For a more complete list, please see the news:
http://sqlobject.org/News.html

What is SQLObject
=================

SQLObject is an object-relational mapper.  Your database tables are described
as classes, and rows are instances of those classes.  SQLObject is meant to be
easy to use and quick to get started with.

SQLObject supports a number of backends: MySQL, PostgreSQL, SQLite,
Firebird, Sybase, MSSQL and MaxDB (also known as SAPDB).

Python 2.6 or 2.7 is required.

Where is SQLObject
==================

Site:
http://sqlobject.org
(Continue reading)

Oleg Broytman | 8 May 09:31 2016
X-Face
Gravatar

SQLObject 2.2

Hello!

I'm pleased to announce version 2.2.0, the first stable release of branch
2.2 of SQLObject.

What's new in SQLObject
=======================

Features & Interface
--------------------

* Add function col.use_microseconds(True/False). Default is to use
  microseconds (True).

* For MSSQL use datetime2(6) and time(6) columns.

* Columns for ForeignKey are created using idType of the referenced
  table.

Minor features
--------------

* Add sqlbuilder.CONCAT to generate concatenation command (either using
  function CONCAT() or '||' operator).

* Minor refactoring to pave the way to Python 3.

* Document MSSQL server versions.

Bugfixes
(Continue reading)

Emmert, Steve | 8 Apr 19:13 2016

Can't Install SQLObject

I need to install SQLObject on a machine that is isolated from the Internet, so I downloaded the package on another machine and copied it over and unzipped it.  I do not see a setup.py file or .egg file so I can’t see how to install it.   What should I do, other than get an Internet connection?

 

Steve Emmert

 

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial! http://pubads.g.doubleclick.net/
gampad/clk?id=1444514301&iu=/ca-pub-7940484522588532
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
Jordan Thompson | 25 Mar 16:06 2016

Intermediate tables with MySql and SQLObject

Hi there,
I have the following tables:
class VmThread(sqlobject.SQLObject):
name = sqlobject.StringCol(length=999, varchar=True, unique=True, notNull=True)
state = sqlobject.StringCol(length=999, varchar=True, unique=True, notNull=True)
vm_id = sqlobject.IntCol(notNull=True)
sessions = sqlobject.RelatedJoin('Session')

class Session(sqlobject.SQLObject):
num_vms = sqlobject.IntCol(notNull=True)
start_time = sqlobject.DateTimeCol(notNull=True)
end_time = sqlobject.DateTimeCol(default=None)
vm_threads = sqlobject.RelatedJoin('VmThread')

I am running this on a MySql database and I expected an intermediate table with foreign keys but they are not created.  When the createTable method is called on the two objects I get the following three tables (as I expected):mysql> desc vm_thread;
+-------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| name | varchar(999) | NO | UNI | NULL | |
| state | varchar(999) | NO | UNI | NULL | |
| vm_id | int(11) | NO | | NULL | |
+-------+--------------+------+-----+---------+----------------+
mysql> desc session; +-------------------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------------+-------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | num_vms | int(11) | NO | | NULL | | | start_time | datetime(6) | NO | | NULL | | | end_time | datetime(6) | YES | | NULL | | +-------------------+-------------+------+-----+---------+----------------+
mysql> desc session_vm_thread; +--------------+---------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------+---------+------+-----+---------+-------+ | session_id | int(11) | NO | | NULL | | | vm_thread_id | int(11) | NO | | NULL | | +--------------+---------+------+-----+---------+-------+

However, I was expecting a foreign key into the intermediate table but it was not created:mysql> select table_name, column_name, constraint_name, referenced_table_name, referenced_column_name -> from information_schema.key_column_usage -> where referenced_table_name = "vm_thread"; Empty set (0.08 sec)
mysql> select table_name, column_name, constraint_name, referenced_table_name, referenced_column_name -> from information_schema.key_column_usage -> where referenced_table_name = "session_vm_thread"; Empty set (0.08 sec)
What am I missing?
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
Paul Otto Seidon | 7 Jan 16:03 2016
Picon

How to order a table by fields of an other table connected to the first one by ForeignKey()

Hi all,

this seems somehow related to a recent post asking about "querying for 
foreign key". Here as well, I guess, tables have to be joined, but I 
don't see how to pack this into a single ORDERBY clause.

The main table is Entry, which owns _status = ForeignKey( "Status"). 
Status owns a field 'value' besides some other fields. Now I would like 
the Entry rows I select by some other criterion (e.g. their priority) be 
ordered by the value field of the Status of the Entry.

When I ORDERBY Status.q._value then SQLOBJECT correctly tells me, that 
Entry doesn't own a _value field. All other combinations don't work 
neither. 

This has to be done more SQL-ish, right?

Anyone willing to help me out here?

Cheers
Paul

------------------------------------------------------------------------------
Oleg Broytman | 24 Dec 21:10 2015
X-Face
Gravatar

SQLObject 2.2.0b2 and 3.0.0a2

Hello!

I'm pleased to announce versions 2.2.0b2 and 3.0.0a2 of SQLObject.

What's new in SQLObject since 2.2.0b1 (and 3.0.0a1)
===================================================

* Columns for ForeignKey are created using idType of the referenced
  table.

* Added new test help setupCyclicClasses to setup classes with mutual
  references.

Contributor for this release is Nathan Edwards.

For a more complete list, please see the news:
http://sqlobject.org/News.html

What is SQLObject
=================

SQLObject is an object-relational mapper.  Your database tables are described
as classes, and rows are instances of those classes.  SQLObject is meant to be
easy to use and quick to get started with.

SQLObject supports a number of backends: MySQL, PostgreSQL, SQLite,
Firebird, Sybase, MSSQL and MaxDB (also known as SAPDB).

Python 2.6 or 2.7 is required.

Where is SQLObject
==================

Site:
http://sqlobject.org

Development:
http://sqlobject.org/devel/

Mailing list:
https://lists.sourceforge.net/mailman/listinfo/sqlobject-discuss

Archives:
http://news.gmane.org/gmane.comp.python.sqlobject

Download:
https://pypi.python.org/pypi/SQLObject/2.2.0b2dev-20151224

News and changes:
http://sqlobject.org/News.html

Oleg.
--

-- 
     Oleg Broytman            http://phdru.name/            phd <at> phdru.name
           Programmers don't die, they just GOSUB without RETURN.

------------------------------------------------------------------------------
Nathan Edwards | 22 Dec 18:50 2015
Picon

Strange ForeignKey behavior...


A number of my students used some form of the ForeignKey abuse shown
below. The first one B(anInt=2,afk=a.id) is pretty benign (though
unnecessary), but the really strange one is B(anInt=4,afk='Strange!').
At least with sqlite3 as the backend, this is stored in the database as
a string (!!!!), even though the schema declares it as an INT and
formalizes the reference constraint to table A's id (also an INT).

Python 2.7.3, SQLObject version 2.1.2.

from sqlobject import *

class A(SQLObject):
    aFloat = FloatCol()

class B(SQLObject):
    anInt = IntCol()
    afk = ForeignKey("A")

sqlhub.processConnection = connectionForURI('sqlite:test.db3?debug=1')

A.dropTable(ifExists=True)
B.dropTable(ifExists=True)
A.createTable()
B.createTable()

a = A(aFloat=1.0)

b = B(anInt=1,afk=a)
b = B(anInt=2,afk=a.id)
b = B(anInt=3,afk=str(a.id))
# This succeeds and is inserted to sqlite database!
b = B(anInt=4,afk='Strange!')
# IntCols are checked!
# This throws a formencode exception
# b = B(anInt='a string',afk=a)

for a in A.select():
    print a
for b in B.select():
    # ValueError exception thrown in attempt to dereference
    print b,b.afk

- n

--

-- 
Dr. Nathan Edwards                      nje5 <at> georgetown.edu
Department of Biochemistry and Molecular & Cellular Biology
            Georgetown University Medical Center
                Room 1217, Harris Building,
        3300 Whitehaven St, NW, Washington DC 20007
           Phone: 202-687-7042, Fax: 202-687-0057

------------------------------------------------------------------------------
QQ邮箱 | 20 Dec 14:38 2015

sqlobject how to limit return column list

Hi. I love sqlojbect very much.

Please forgive my poor English,

Example code:

class MyUser(SQLObject):
  name=StringCol()
  mobile=StringCol()
  ….
  depart=StringCol()
  sex =StringCol()

i want limit return column,
data=MyUser.selectBy(depart=‘xxx’,items=[’name’,’sex'])

only name and sex column in data.

Any help would be much appreciated!

------------------------------------------------------------------------------
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
joshua | 16 Dec 00:49 2015
Picon

sqlobject one-to-many join question

So I've been absolutely loving sqlobject, until I get to actually get to making relations between tables.  At this point, I feel that the 'documentation' covers some points, but really doesn't explain other bits very well at all.

So I have 2 problems:

The first is that when running my program the first time, it fails to create all the tables (using .createTable(ifNotExists = True))  and only several tables are generated, before it errors out with:
sqlobject.dberrors.OperationalError: Can't create table `rainmeter`.`#sql-65c_209` (errno: 150 "Foreign key constraint is incorrectly formed")
Then running it again causes the rest of the tables to be created.
 
Here's the relevant parts of my class definitions:
 
class Table_Sensors(sqlobject.SQLObject):
    name = sqlobject.StringCol(length=32)
    group = sqlobject.ForeignKey("Table_Groups")
class Table_Groups(sqlobject.SQLObject):
    name = sqlobject.StringCol(length=32)
    sensors = sqlobject.MultipleJoin("Table_Sensors")
Table_Sensors.createTable(ifNotExists = True)
Table_Groups.createTable(ifNotExists = True)
 
Anyways, this is inconvenient, but it does work after running it again, so I can put up with it.  The real problem I've been having is that I'm having trouble figuring out how to select all entries in Table_Sensors that point to a specific Table_Groups.
 
Here's one example I've tried:
Table_Groups.select(Table_Groups.q.name=="Feels_Like", Table_Groups.q.sensors==Table_Sensors.q.group, orderBy=Table_Sensors.q.sort_order)
 
But no matter what I try, even a much simpler query, It just spits back:
AttributeError: Table_Groups instance has no attribute 'sensors'
 
As a side-note, I think some of the things I'm trying to do, I could use j-magic for, but the section on that is incredibly short, and I haven't been able to get that to work either :/
------------------------------------------------------------------------------
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
joshua | 14 Dec 08:34 2015
Picon

sqlobject with wsgi

I seem to be having troubles getting sqlobject to play nicely with wsgi.

In short, sqlobject seems to be returning the same data that was fetched 
before each time, until Apache is restarted.

Example code:  (much simplified)

now = Table_Now.get(1)
data["some_field"] = now.some_field
//do something with data{}

but even though the row being returned (I simplified it to the code 
above with a single row to try to pinpoint the problem) is actually 
being changed in the SQL db (mySQL) sqlobject always returns the same, 
old data...

I did see mentioned somewhere about "sqlobject.wsgi_middleware," but I 
can't seem to figure out how that is supposed to be implemented, and 
unfortunatly, there doesn't seem to be any documentation covering that 
anywhere...

Any help would be much appreciated!

------------------------------------------------------------------------------

Gmane