sqlobject-discuss Mailing List for SQLObject (Page 4)
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
You can subscribe to this list here.
2003 |
Jan
|
Feb
(2) |
Mar
(43) |
Apr
(204) |
May
(208) |
Jun
(102) |
Jul
(113) |
Aug
(63) |
Sep
(88) |
Oct
(85) |
Nov
(95) |
Dec
(62) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(38) |
Feb
(93) |
Mar
(125) |
Apr
(89) |
May
(66) |
Jun
(65) |
Jul
(53) |
Aug
(65) |
Sep
(79) |
Oct
(60) |
Nov
(171) |
Dec
(176) |
2005 |
Jan
(264) |
Feb
(260) |
Mar
(145) |
Apr
(153) |
May
(192) |
Jun
(166) |
Jul
(265) |
Aug
(340) |
Sep
(300) |
Oct
(469) |
Nov
(316) |
Dec
(235) |
2006 |
Jan
(236) |
Feb
(156) |
Mar
(229) |
Apr
(221) |
May
(257) |
Jun
(161) |
Jul
(97) |
Aug
(169) |
Sep
(159) |
Oct
(400) |
Nov
(136) |
Dec
(134) |
2007 |
Jan
(152) |
Feb
(101) |
Mar
(115) |
Apr
(120) |
May
(129) |
Jun
(82) |
Jul
(118) |
Aug
(82) |
Sep
(30) |
Oct
(101) |
Nov
(137) |
Dec
(53) |
2008 |
Jan
(83) |
Feb
(139) |
Mar
(55) |
Apr
(69) |
May
(82) |
Jun
(31) |
Jul
(66) |
Aug
(30) |
Sep
(21) |
Oct
(37) |
Nov
(41) |
Dec
(65) |
2009 |
Jan
(69) |
Feb
(46) |
Mar
(22) |
Apr
(20) |
May
(39) |
Jun
(30) |
Jul
(36) |
Aug
(58) |
Sep
(38) |
Oct
(20) |
Nov
(10) |
Dec
(11) |
2010 |
Jan
(24) |
Feb
(63) |
Mar
(22) |
Apr
(72) |
May
(8) |
Jun
(13) |
Jul
(35) |
Aug
(23) |
Sep
(12) |
Oct
(26) |
Nov
(11) |
Dec
(30) |
2011 |
Jan
(15) |
Feb
(44) |
Mar
(36) |
Apr
(26) |
May
(27) |
Jun
(10) |
Jul
(28) |
Aug
(12) |
Sep
|
Oct
|
Nov
(17) |
Dec
(16) |
2012 |
Jan
(12) |
Feb
(31) |
Mar
(23) |
Apr
(14) |
May
(10) |
Jun
(26) |
Jul
|
Aug
(2) |
Sep
(2) |
Oct
(1) |
Nov
|
Dec
(6) |
2013 |
Jan
(4) |
Feb
(5) |
Mar
|
Apr
(4) |
May
(13) |
Jun
(7) |
Jul
(5) |
Aug
(15) |
Sep
(25) |
Oct
(18) |
Nov
(7) |
Dec
(3) |
2014 |
Jan
(1) |
Feb
(5) |
Mar
|
Apr
(3) |
May
(3) |
Jun
(2) |
Jul
(4) |
Aug
(5) |
Sep
|
Oct
(11) |
Nov
|
Dec
(62) |
2015 |
Jan
(8) |
Feb
(3) |
Mar
(15) |
Apr
|
May
|
Jun
(6) |
Jul
|
Aug
(6) |
Sep
|
Oct
|
Nov
|
Dec
(19) |
2016 |
Jan
(2) |
Feb
|
Mar
(2) |
Apr
(4) |
May
(3) |
Jun
(7) |
Jul
(14) |
Aug
(13) |
Sep
(6) |
Oct
(2) |
Nov
(3) |
Dec
|
2017 |
Jan
(6) |
Feb
(14) |
Mar
(2) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
(4) |
Nov
(3) |
Dec
|
2018 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2019 |
Jan
|
Feb
(1) |
Mar
|
Apr
(44) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(1) |
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
(1) |
2021 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
(3) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2022 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(1) |
2023 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
(1) |
Nov
(2) |
Dec
|
2024 |
Jan
|
Feb
|
Mar
|
Apr
(4) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2025 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Hugo M. <hu...@ni...> - 2017-10-24 19:15:46
|
Is there any way that I can modify an existing database column, with data in it, without losing the data in it? All I need to be able to do is increase the size of a StringCol. I can see addColumn and delColumn methods of the sqlmeta object, but not an alterColumn or anything similar. Thanks, Hugo. -- Dr Hugo Mills | hu...@ni... Chief Technologist | Nightglass Medical Rostering Ltd | +44 207 040 4054 |
From: Oleg B. <ph...@ph...> - 2017-08-05 17:54:41
|
Hello! I'm pleased to announce version 3.4.0, the first stable release of branch 3.4 of SQLObject. What's new in SQLObject ======================= Contributor for this release is Dr. Neil Muller. Features -------- * Python 2.6 is no longer supported. The minimal supported version is Python 2.7. Drivers (work in progress) -------------------------- * Encode binary values for py-postgresql driver. This fixes the last remaining problems with the driver. * Encode binary values for PyGreSQL driver using the same encoding as for py-postgresql driver. This fixes the last remaining problems with the driver. Our own encoding is needed because unescape_bytea(escape_bytea()) is not idempotent. See the comment for PQunescapeBytea at https://www.postgresql.org/docs/9.6/static/libpq-exec.html: This conversion is not exactly the inverse of PQescapeBytea, because the string is not expected to be "escaped" when received from PQgetvalue. In particular this means there is no need for string quoting considerations. * List all drivers in extras_require in setup.py. Minor features -------------- * Use base64.b64encode/b64decode instead of deprecated encodestring/decodestring. Tests ----- * Fix a bug with sqlite-memory: rollback transaction and close connection. The solution was found by Dr. Neil Muller. * Use remove-old-files.py from ppu to cleanup pip cache at Travis and AppVeyor. * Add test_csvimport.py more as an example how to use load_csv from sqlobject.util.csvimport. 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.7 or 3.4+ is required. Where is SQLObject ================== Site: http://sqlobject.org Development: http://sqlobject.org/devel/ Mailing list: https://lists.sourceforge.net/mailman/listinfo/sqlobject-discuss Download: https://pypi.python.org/pypi/SQLObject/3.4.0 News and changes: http://sqlobject.org/News.html StackOverflow: https://stackoverflow.com/questions/tagged/sqlobject Example ======= Create a simple class that wraps a table:: >>> from sqlobject import * >>> >>> sqlhub.processConnection = connectionForURI('sqlite:/:memory:') >>> >>> class Person(SQLObject): ... fname = StringCol() ... mi = StringCol(length=1, default=None) ... lname = StringCol() ... >>> Person.createTable() Use the object:: >>> p = Person(fname="John", lname="Doe") >>> p <Person 1 fname='John' mi=None lname='Doe'> >>> p.fname 'John' >>> p.mi = 'Q' >>> p2 = Person.get(1) >>> p2 <Person 1 fname='John' mi='Q' lname='Doe'> >>> p is p2 True Queries:: >>> p3 = Person.selectBy(lname="Doe")[0] >>> p3 <Person 1 fname='John' mi='Q' lname='Doe'> >>> pc = Person.select(Person.q.lname=="Doe").count() >>> pc 1 Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2017-05-07 14:24:53
|
Hello! I'm pleased to announce version 3.3.0, the first stable release of branch 3.3 of SQLObject. What's new in SQLObject ======================= Features -------- * Support for Python 2.6 is declared obsolete and will be removed in the next release. Minor features -------------- * Convert scripts repository to devscripts subdirectory. Some of thses scripts are version-dependent so it's better to have them in the main repo. * Test for __nonzero__ under Python 2, __bool__ under Python 3 in BoolCol. Drivers (work in progress) -------------------------- * Add support for PyODBC and PyPyODBC (pure-python ODBC DB API driver) for MySQL, PostgreSQL and MS SQL. Driver names are ``pyodbc``, ``pypyodbc`` or ``odbc`` (try ``pyodbc`` and ``pypyodbc``). There are some problems with pyodbc and many problems with pypyodbc. Documentation ------------- * Stop updating http://sqlobject.readthedocs.org/ - it's enough to have http://sqlobject.org/ Tests ----- * Run tests at Travis CI and AppVeyor with Python 3.6, x86 and x64. * Stop running tests at Travis with Python 2.6. * Stop running tests at AppVeyor with pymssql - too many timeouts and problems. 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, 2.7 or 3.4+ is required. Where is SQLObject ================== Site: http://sqlobject.org Development: http://sqlobject.org/devel/ Mailing list: https://lists.sourceforge.net/mailman/listinfo/sqlobject-discuss Download: https://pypi.python.org/pypi/SQLObject/3.3.0 News and changes: http://sqlobject.org/News.html Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2017-03-11 16:17:46
|
On Sat, Mar 11, 2017 at 05:14:00PM +0100, Oleg Broytman <ph...@ph...> wrote: > I'm pleased to announce version 3.2.0, the first stable release of branch > 3.2 of SQLObject. Changes since beta1: * Add a section to DeveloperGuide about branch workflow. * Fixed access to _sources and _static subdirectories at Github Pages by adding an empty .nojekyll file. * Upload eggs for Python 3.5 to PyPI. Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2017-03-11 16:14:08
|
Hello! I'm pleased to announce version 3.2.0, the first stable release of branch 3.2 of SQLObject. What's new in SQLObject ======================= Contributor for this release is Neil Muller. Minor features -------------- * Drop table name from ``VACUUM`` command in SQLiteConnection: SQLite doesn't vacuum a single table and SQLite 3.15 uses the supplied name as the name of the attached database to vacuum. * Remove ``driver`` keyword from RdbhostConnection as it allows one driver ``rdbhdb``. * Add ``driver`` keyword for FirebirdConnection. Allowed values are 'fdb', 'kinterbasdb' and 'pyfirebirdsql'. Default is to test 'fdb' and 'kinterbasdb' in that order. pyfirebirdsql is supported but has problems. * Add ``driver`` keyword for MySQLConnection. Allowed values are 'mysqldb', 'connector', 'oursql' and 'pymysql'. Default is to test for mysqldb only. * Add support for `MySQL Connector <https://pypi.python.org/pypi/mysql-connector>`_ (pure python; `binary packages <https://dev.mysql.com/doc/connector-python/en/>`_ are not at PyPI and hence are hard to install and test). * Add support for `oursql <https://github.com/python-oursql/oursql>`_ MySQL driver (only Python 2.6 and 2.7 until oursql author fixes Python 3 compatibility). * Add support for `PyMySQL <https://github.com/PyMySQL/PyMySQL/>`_ - pure python mysql interface). * Add parameter ``timeout`` for MSSQLConnection (usable only with pymssql driver); timeouts are in seconds. * Remove deprecated ez_setup.py. Drivers (work in progress) -------------------------- * Extend support for PyGreSQL driver. There are still some problems. * Add support for `py-postgresql <https://pypi.python.org/pypi/py-postgresql>`_ PostgreSQL driver. There are still problems with the driver. * Add support for `pyfirebirdsql <https://pypi.python.org/pypi/firebirdsql>`_.There are still problems with the driver. Bug fixes --------- * Fix MSSQLConnection.columnsFromSchema: remove `(` and `)` from default value. * Fix MSSQLConnection and SybaseConnection: insert default values into a table with just one IDENTITY column. * Remove excessive NULLs from ``CREATE TABLE`` for MSSQL/Sybase. * Fix concatenation operator for MSSQL/Sybase (it's ``+``, not ``||``). * Fix MSSQLConnection.server_version() under Py3 (decode version to str). Documentation ------------- * The docs are now generated with Sphinx. * Move ``docs/LICENSE`` to the top-level directory so that Github recognizes it. Tests ----- * Rename ``py.test`` -> ``pytest`` in tests and docs. * Great Renaming: fix ``pytest`` warnings by renaming ``TestXXX`` classes to ``SOTestXXX`` to prevent ``pytest`` to recognize them as test classes. * Fix ``pytest`` warnings by converting yield tests to plain calls: yield tests were deprecated in ``pytest``. * Tests are now run at CIs with Python 3.5. * Drop ``Circle CI``. * Run at Travis CI tests with Firebird backend (server version 2.5; drivers fdb and firebirdsql). There are problems with tests. * Run tests at AppVeyor for windows testing. Run tests with MS SQL, MySQL, Postgres and SQLite backends; use Python 2.7, 3.4 and 3.5, x86 and x64. There are problems with MS SQL and MySQL. 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, 2.7 or 3.4+ 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/3.2.0 News and changes: http://sqlobject.org/News.html Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2017-02-23 13:58:18
|
On Thu, Feb 23, 2017 at 02:54:11PM +0100, Oleg Broytman <ph...@ph...> wrote: > I'm pleased to announce version 3.2.0b1, the first beta of the upcoming > release of branch 3.2 of SQLObject. What really changed since alpha1: * Remove pg8000 driver. * Tweaks in running Firebird server at Travis. * Run tests at AppVeyor with MySQL, PostgreSQL, SQLite and MS SQL; with Python 3.4 and 3.5; x86 and x64. Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2017-02-23 13:54:20
|
Hello! I'm pleased to announce version 3.2.0b1, the first beta of the upcoming release of branch 3.2 of SQLObject. What's new in SQLObject ======================= Contributor for this release is Neil Muller. Minor features -------------- * Drop table name from ``VACUUM`` command in SQLiteConnection: SQLite doesn't vacuum a single table and SQLite 3.15 uses the supplied name as the name of the attached database to vacuum. * Remove ``driver`` keyword from RdbhostConnection as it allows one driver ``rdbhdb``. * Add ``driver`` keyword for FirebirdConnection. Allowed values are 'fdb', 'kinterbasdb' and 'pyfirebirdsql'. Default is to test 'fdb' and 'kinterbasdb' in that order. pyfirebirdsql is supported but has problems. * Add ``driver`` keyword for MySQLConnection. Allowed values are 'mysqldb', 'connector', 'oursql' and 'pymysql'. Default is to test for mysqldb only. * Add support for `MySQL Connector <https://pypi.python.org/pypi/mysql-connector>`_ (pure python; `binary packages <https://dev.mysql.com/doc/connector-python/en/>`_ are not at PyPI and hence are hard to install and test). * Add support for `oursql <https://github.com/python-oursql/oursql>`_ MySQL driver (only Python 2.6 and 2.7 until oursql author fixes Python 3 compatibility). * Add support for `PyMySQL <https://github.com/PyMySQL/PyMySQL/>`_ - pure python mysql interface). * Add parameter ``timeout`` for MSSQLConnection (usable only with pymssql driver); timeouts are in seconds. * Remove deprecated ez_setup.py. Drivers (work in progress) -------------------------- * Extend support for PyGreSQL driver. There are still some problems. * Add support for `py-postgresql <https://pypi.python.org/pypi/py-postgresql>`_ PostgreSQL driver. There are still problems with the driver. * Add support for `pyfirebirdsql <https://pypi.python.org/pypi/firebirdsql>`_.There are still problems with the driver. Bug fixes --------- * Fix MSSQLConnection.columnsFromSchema: remove `(` and `)` from default value. * Fix MSSQLConnection and SybaseConnection: insert default values into a table with just one IDENTITY column. * Remove excessive NULLs from ``CREATE TABLE`` for MSSQL/Sybase. * Fix concatenation operator for MSSQL/Sybase (it's ``+``, not ``||``). * Fix MSSQLConnection.server_version() under Py3 (decode version to str). Documentation ------------- * The docs are now generated with Sphinx. * Move ``docs/LICENSE`` to the top-level directory so that Github recognizes it. Tests ----- * Rename ``py.test`` -> ``pytest`` in tests and docs. * Great Renaming: fix ``pytest`` warnings by renaming ``TestXXX`` classes to ``SOTestXXX`` to prevent ``pytest`` to recognize them as test classes. * Fix ``pytest`` warnings by converting yield tests to plain calls: yield tests were deprecated in ``pytest``. * Tests are now run at CIs with Python 3.5. * Drop ``Circle CI``. * Run at Travis CI tests with Firebird backend (server version 2.5; drivers fdb and firebirdsql). There are problems with tests. * Run tests at AppVeyor for windows testing. Run tests with MS SQL, MySQL, Postgres and SQLite backends; use Python 2.7, 3.4 and 3.5, x86 and x64. There are problems with MS SQL and MySQL. 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, 2.7 or 3.4+ 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/3.2.0b1.dev20170223 News and changes: http://sqlobject.org/News.html Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: janemba <cap...@gm...> - 2017-02-07 08:11:15
|
On 02/07/2017 02:21 AM, Oleg Broytman wrote: > > 'name' in SQLObject is a pythonic name of column; if you want to > provide a database name it's called 'dbName': > > class User(sqlobject.SQLObject): > > class sqlmeta: > table = 'tbl_user' > idName = 'user_id' > > user_section = sqlobject.ForeignKey('Section', dbName='user_section') > > Also you have to know that translation from names to dbName's is > performed by an instance of Style. See styles.py and > tests/test_style.py. If you don't want to submit to default SQLObject > style (which, among other things, adds '_id' to ForeignKey's) and don't > want to provide dbName for every column you can create your own Style > and override the default. > Got it ! Nice answer. Thx |
From: Oleg B. <ph...@ph...> - 2017-02-07 01:21:42
|
Hi! On Tue, Feb 07, 2017 at 12:34:36AM +0100, janemba <cap...@gm...> wrote: > Hi, > > I'm experiencing an issue with ForeignKey. First of all, all my primary > keys use idName attribute as classes use a different name. So I built > the following classes : > > ------ > > class User(sqlobject.SQLObject): > > class sqlmeta: > table = 'tbl_user' > idName = 'user_id' > idType = int By default idType is int so you don't need it. But you can do it if you want to be extra explicit. > user_firstname = sqlobject.StringCol(length=45) > user_lastname = sqlobject.StringCol(length=45) > user_email = sqlobject.StringCol(length=45) > user_phone = sqlobject.StringCol(length=20) > user_password = sqlobject.StringCol(length=128) > user_city = sqlobject.StringCol(length=45) > user_country = sqlobject.StringCol(length=45) Please remove anything that's not related to your question. Too much information could be worse than too little. > user_section = sqlobject.ForeignKey('Section') > > class Section(sqlobject.SQLObject): > > class sqlmeta: > table = 'tbl_section' > idName = 'section_id' > idType = int > > section_name = sqlobject.StringCol(length=128) > > ------ > > > And then the debug output : > > 1/QueryOne: SELECT user_firstname, user_lastname, user_email, > user_phone, user_password, user_city, user_country, user_section_id FROM > tbl_user WHERE ((tbl_user.user_id) = (1)) > > As you can see the column "user_section_id" has been generated by > SQLObject. But that column doesn't exists. It should be "user_section" > from table "tbl_user". I tried with the attribute "name" with ForeignKey > method but the requests remain the same. > > Do you know how to fix that ? 'name' in SQLObject is a pythonic name of column; if you want to provide a database name it's called 'dbName': class User(sqlobject.SQLObject): class sqlmeta: table = 'tbl_user' idName = 'user_id' user_section = sqlobject.ForeignKey('Section', dbName='user_section') Also you have to know that translation from names to dbName's is performed by an instance of Style. See styles.py and tests/test_style.py. If you don't want to submit to default SQLObject style (which, among other things, adds '_id' to ForeignKey's) and don't want to provide dbName for every column you can create your own Style and override the default. > Cheers, Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: janemba <cap...@gm...> - 2017-02-06 23:34:47
|
Hi, I'm experiencing an issue with ForeignKey. First of all, all my primary keys use idName attribute as classes use a different name. So I built the following classes : ------ class User(sqlobject.SQLObject): class sqlmeta: table = 'tbl_user' idName = 'user_id' idType = int user_firstname = sqlobject.StringCol(length=45) user_lastname = sqlobject.StringCol(length=45) user_email = sqlobject.StringCol(length=45) user_phone = sqlobject.StringCol(length=20) user_password = sqlobject.StringCol(length=128) user_city = sqlobject.StringCol(length=45) user_country = sqlobject.StringCol(length=45) user_section = sqlobject.ForeignKey('Section') class Section(sqlobject.SQLObject): class sqlmeta: table = 'tbl_section' idName = 'section_id' idType = int section_name = sqlobject.StringCol(length=128) ------ And then the debug output : 1/QueryOne: SELECT user_firstname, user_lastname, user_email, user_phone, user_password, user_city, user_country, user_section_id FROM tbl_user WHERE ((tbl_user.user_id) = (1)) As you can see the column "user_section_id" has been generated by SQLObject. But that column doesn't exists. It should be "user_section" from table "tbl_user". I tried with the attribute "name" with ForeignKey method but the requests remain the same. Do you know how to fix that ? Cheers, |
From: janemba <cap...@gm...> - 2017-02-05 20:09:11
|
On 02/05/2017 09:07 PM, Oleg Broytman wrote: > Please reread carefully all my comments and the code in the previous > message. I already pointed to the root of the problem. > > On Sun, Feb 05, 2017 at 09:01:15PM +0100, janemba <cap...@gm...> wrote: >> On 02/05/2017 07:43 PM, Oleg Broytman wrote: >>> On Sun, Feb 05, 2017 at 07:16:48PM +0100, janemba <cap...@gm...> wrote: >>>> Hi, >>>> >>>> I have an issue with table name. I use my own naming for class name but >>>> it doesn't correspond to the table >>>> name. So, I use sql_meta with table attribute but it doesn't work. >>> sqlmeta, not sql_meta. >>> >>>> I have the following error : >>>> >>>> sqlobject.dberrors.ProgrammingError: Table 'foo.bar' doesn't exist >>>> >>>> Is it possible to use custom class name that do not correspond to table >>>> name ? >>> Works for me. Example: >>> >>> from sqlobject import * >>> >>> __connection__ = "sqlite:/:memory:?debug=1&debugOutput=1" >>> >>> class Person(SQLObject): >>> class sqlmeta: >>> table = 'city_person' >>> name = StringCol() >>> pets = MultipleJoin('Animal', joinColumn='owner_id') >>> >>> class Animal(SQLObject): >>> class sqlmeta: >>> table = 'city_animal' >>> name = StringCol() >>> owner = ForeignKey('Person') >>> >>> Person.createTable() >>> Animal.createTable() >>> >>> Debug output: >>> >>> 1/QueryR : CREATE TABLE city_person ( >>> id INTEGER PRIMARY KEY AUTOINCREMENT, >>> name TEXT >>> ) >>> 2/QueryR : CREATE TABLE city_animal ( >>> id INTEGER PRIMARY KEY AUTOINCREMENT, >>> name TEXT, >>> owner_id INT CONSTRAINT owner_id_exists REFERENCES city_person(id) >>> ) >>> >> That's strange, here what I do : >> >> class User(sqlobject.SQLObject): >> class sql_meta: >> table = 'tbl_user' >> idName = 'user_id' >> idType = int >> >> user_firstname = sqlobject.StringCol(length=45) >> user_lastname = sqlobject.StringCol(length=45) >> user_email = sqlobject.StringCol(length=45) >> user_phone = sqlobject.StringCol(length=20) >> user_password = sqlobject.StringCol(length=128) >> user_city = sqlobject.StringCol(length=45) >> user_country = sqlobject.StringCol(length=45) >> >> User.get(1) >> >> 1/QueryOne: SELECT user_firstname, user_lastname, user_email, >> user_phone, user_password, user_city, user_country FROM user WHERE >> ((user.id) = (1)) > Oleg. Oups sorry...problem fixed :) |
From: Oleg B. <ph...@ph...> - 2017-02-05 20:07:58
|
Please reread carefully all my comments and the code in the previous message. I already pointed to the root of the problem. On Sun, Feb 05, 2017 at 09:01:15PM +0100, janemba <cap...@gm...> wrote: > On 02/05/2017 07:43 PM, Oleg Broytman wrote: > > On Sun, Feb 05, 2017 at 07:16:48PM +0100, janemba <cap...@gm...> wrote: > >> Hi, > >> > >> I have an issue with table name. I use my own naming for class name but > >> it doesn't correspond to the table > >> name. So, I use sql_meta with table attribute but it doesn't work. > > sqlmeta, not sql_meta. > > > >> I have the following error : > >> > >> sqlobject.dberrors.ProgrammingError: Table 'foo.bar' doesn't exist > >> > >> Is it possible to use custom class name that do not correspond to table > >> name ? > > Works for me. Example: > > > > from sqlobject import * > > > > __connection__ = "sqlite:/:memory:?debug=1&debugOutput=1" > > > > class Person(SQLObject): > > class sqlmeta: > > table = 'city_person' > > name = StringCol() > > pets = MultipleJoin('Animal', joinColumn='owner_id') > > > > class Animal(SQLObject): > > class sqlmeta: > > table = 'city_animal' > > name = StringCol() > > owner = ForeignKey('Person') > > > > Person.createTable() > > Animal.createTable() > > > > Debug output: > > > > 1/QueryR : CREATE TABLE city_person ( > > id INTEGER PRIMARY KEY AUTOINCREMENT, > > name TEXT > > ) > > 2/QueryR : CREATE TABLE city_animal ( > > id INTEGER PRIMARY KEY AUTOINCREMENT, > > name TEXT, > > owner_id INT CONSTRAINT owner_id_exists REFERENCES city_person(id) > > ) > > > > That's strange, here what I do : > > class User(sqlobject.SQLObject): > class sql_meta: > table = 'tbl_user' > idName = 'user_id' > idType = int > > user_firstname = sqlobject.StringCol(length=45) > user_lastname = sqlobject.StringCol(length=45) > user_email = sqlobject.StringCol(length=45) > user_phone = sqlobject.StringCol(length=20) > user_password = sqlobject.StringCol(length=128) > user_city = sqlobject.StringCol(length=45) > user_country = sqlobject.StringCol(length=45) > > User.get(1) > > 1/QueryOne: SELECT user_firstname, user_lastname, user_email, > user_phone, user_password, user_city, user_country FROM user WHERE > ((user.id) = (1)) Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: janemba <cap...@gm...> - 2017-02-05 20:01:26
|
On 02/05/2017 07:43 PM, Oleg Broytman wrote: > On Sun, Feb 05, 2017 at 07:16:48PM +0100, janemba <cap...@gm...> wrote: >> Hi, >> >> I have an issue with table name. I use my own naming for class name but >> it doesn't correspond to the table >> name. So, I use sql_meta with table attribute but it doesn't work. > sqlmeta, not sql_meta. > >> I have the following error : >> >> sqlobject.dberrors.ProgrammingError: Table 'foo.bar' doesn't exist >> >> Is it possible to use custom class name that do not correspond to table >> name ? > Works for me. Example: > > from sqlobject import * > > __connection__ = "sqlite:/:memory:?debug=1&debugOutput=1" > > class Person(SQLObject): > class sqlmeta: > table = 'city_person' > name = StringCol() > pets = MultipleJoin('Animal', joinColumn='owner_id') > > class Animal(SQLObject): > class sqlmeta: > table = 'city_animal' > name = StringCol() > owner = ForeignKey('Person') > > Person.createTable() > Animal.createTable() > > Debug output: > > 1/QueryR : CREATE TABLE city_person ( > id INTEGER PRIMARY KEY AUTOINCREMENT, > name TEXT > ) > 2/QueryR : CREATE TABLE city_animal ( > id INTEGER PRIMARY KEY AUTOINCREMENT, > name TEXT, > owner_id INT CONSTRAINT owner_id_exists REFERENCES city_person(id) > ) > That's strange, here what I do : class User(sqlobject.SQLObject): class sql_meta: table = 'tbl_user' idName = 'user_id' idType = int user_firstname = sqlobject.StringCol(length=45) user_lastname = sqlobject.StringCol(length=45) user_email = sqlobject.StringCol(length=45) user_phone = sqlobject.StringCol(length=20) user_password = sqlobject.StringCol(length=128) user_city = sqlobject.StringCol(length=45) user_country = sqlobject.StringCol(length=45) User.get(1) 1/QueryOne: SELECT user_firstname, user_lastname, user_email, user_phone, user_password, user_city, user_country FROM user WHERE ((user.id) = (1)) |
From: Oleg B. <ph...@ph...> - 2017-02-05 18:43:09
|
On Sun, Feb 05, 2017 at 07:16:48PM +0100, janemba <cap...@gm...> wrote: > Hi, > > I have an issue with table name. I use my own naming for class name but > it doesn't correspond to the table > name. So, I use sql_meta with table attribute but it doesn't work. sqlmeta, not sql_meta. > I have the following error : > > sqlobject.dberrors.ProgrammingError: Table 'foo.bar' doesn't exist > > Is it possible to use custom class name that do not correspond to table > name ? Works for me. Example: from sqlobject import * __connection__ = "sqlite:/:memory:?debug=1&debugOutput=1" class Person(SQLObject): class sqlmeta: table = 'city_person' name = StringCol() pets = MultipleJoin('Animal', joinColumn='owner_id') class Animal(SQLObject): class sqlmeta: table = 'city_animal' name = StringCol() owner = ForeignKey('Person') Person.createTable() Animal.createTable() Debug output: 1/QueryR : CREATE TABLE city_person ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT ) 2/QueryR : CREATE TABLE city_animal ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, owner_id INT CONSTRAINT owner_id_exists REFERENCES city_person(id) ) > Cheers, Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: janemba <cap...@gm...> - 2017-02-05 18:16:59
|
Hi, I have an issue with table name. I use my own naming for class name but it doesn't correspond to the table name. So, I use sql_meta with table attribute but it doesn't work. I have the following error : sqlobject.dberrors.ProgrammingError: Table 'foo.bar' doesn't exist Is it possible to use custom class name that do not correspond to table name ? Cheers, |
From: Oleg B. <ph...@ph...> - 2017-02-05 16:54:57
|
Hello! I'm pleased to announce version 3.2.0a1, the first alpha of the upcoming release of branch 3.2 of SQLObject. What's new in SQLObject ======================= Minor features -------------- * Drop table name from ``VACUUM`` command in SQLiteConnection: SQLite doesn't vacuum a single table and SQLite 3.15 uses the supplied name as the name of the attached database to vacuum. * Remove ``driver`` keyword from RdbhostConnection as it allows one driver ``rdbhdb``. * Add ``driver`` keyword for FirebirdConnection. Allowed values are 'fdb', 'kinterbasdb' and 'pyfirebirdsql'. Default is to test 'fdb' and 'kinterbasdb' in that order. pyfirebirdsql is supported but has problems. * Add ``driver`` keyword for MySQLConnection. Allowed values are 'mysqldb', 'connector', 'oursql' and 'pymysql'. Default is to test for mysqldb only. * Add support for `MySQL Connector <https://pypi.python.org/pypi/mysql-connector>`_ (pure python; `binary packages <https://dev.mysql.com/doc/connector-python/en/>`_ are not at PyPI and hence are hard to install and test). * Add support for `oursql <https://github.com/python-oursql/oursql>`_ MySQL driver (only Python 2.6 and 2.7 until oursql author fixes Python 3 compatibility). * Add support for `PyMySQL <https://github.com/PyMySQL/PyMySQL/>`_ - pure python mysql interface). * Add parameter ``timeout`` for MSSQLConnection (usable only with pymssql driver); timeouts are in seconds. * Remove deprecated ez_setup.py. Drivers (work in progress) -------------------------- * Extend support for PyGreSQL driver. There are still some problems. * Add support for `py-postgresql <https://pypi.python.org/pypi/py-postgresql>`_ PostgreSQL driver. There are still problems with the driver. * Add support for `pg8000 <https://pypi.python.org/pypi/pg8000>`_ PostgreSQL driver. There are major problems with the driver caused by both the driver and SQLObject. * Add support for `pyfirebirdsql <https://pypi.python.org/pypi/firebirdsql>`_.There are still problems with the driver. Bug fixes --------- * Fix MSSQLConnection.columnsFromSchema: remove `(` and `)` from default value. * Fix MSSQLConnection and SybaseConnection: insert default values into a table with just one IDENTITY column. * Remove excessive NULLs from ``CREATE TABLE`` for MSSQL/Sybase. * Fix concatenation operator for MSSQL/Sybase (it's ``+``, not ``||``). * Fix MSSQLConnection.server_version() under Py3 (decode version to str). Documentation ------------- * The docs are now generated with Sphinx. * Move ``docs/LICENSE`` to the top-level directory so that Github recognizes it. Tests ----- * Rename ``py.test`` -> ``pytest`` in tests and docs. * Great Renaming: fix ``pytest`` warnings by renaming ``TestXXX`` classes to ``SOTestXXX`` to prevent ``pytest`` to recognize them as test classes. * Fix ``pytest`` warnings by converting yield tests to plain calls: yield tests were deprecated in ``pytest``. * Tests are now run at CIs with Python 3.5. * Drop ``Circle CI``. * Run at Travis CI tests with Firebird backend (server version 2.5; drivers fdb and firebirdsql). There are problems with tests. * Run tests at AppVeyor for windows testing. Run tests with MS SQL, Postgres and SQLite. There are problems with MS SQL. Contributor for this release is Neil Muller. 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, 2.7 or 3.4+ 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/3.2.0a1.dev20170205 News and changes: http://sqlobject.org/News.html Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: janemba <cap...@gm...> - 2017-02-05 12:03:02
|
On 02/05/2017 01:01 PM, Oleg Broytman wrote: > Hi! Welcome! > > SQLObject requires that tables have single PRIMARY KEY columns, not > necessary integer (strings are ok) and not necessary named 'id'. But the > PRIMARY KEY must be single column, and SQLObject always refers to the > column as '.id'. > You can declare name and type of the column in sqlmeta inner class: > > class MyTable(SQLObject): > class sqlmeta: > idName = 'my_id' > idType = str Great, thx !! |
From: Oleg B. <ph...@ph...> - 2017-02-05 12:01:28
|
Hi! Welcome! On Sun, Feb 05, 2017 at 11:54:50AM +0100, janemba <cap...@gm...> wrote: > Hi, > > I'm new SQLObject and I'm reading multiple documentations. I noticed > that primary key is implicitly created by SQLObject by using "id" > column. However, I want to use a custom one with a different name (my > columns and tables are already created). How can I do that ? SQLObject requires that tables have single PRIMARY KEY columns, not necessary integer (strings are ok) and not necessary named 'id'. But the PRIMARY KEY must be single column, and SQLObject always refers to the column as '.id'. You can declare name and type of the column in sqlmeta inner class: class MyTable(SQLObject): class sqlmeta: idName = 'my_id' idType = str > Cheers Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: janemba <cap...@gm...> - 2017-02-05 10:55:01
|
Hi, I'm new SQLObject and I'm reading multiple documentations. I noticed that primary key is implicitly created by SQLObject by using "id" column. However, I want to use a custom one with a different name (my columns and tables are already created). How can I do that ? Cheers |
From: Oleg B. <ph...@ph...> - 2017-01-13 23:34:12
|
Hello! Kudos to Dr. Neil Muller who implemented test run at AppVeyor (thank you again, Neil!) I fixed a few minor problems with tests and now we have Postgres and SQLite tests passing on w32: https://ci.appveyor.com/project/phdru/sqlobject Unfortunately MS SQL tests have a strange timeout. Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2017-01-12 23:05:57
|
Hi, All! On Tue, Jan 03, 2017 at 08:29:37PM +0100, Oleg Broytman <ph...@ph...> wrote: > Any user of Firebird/Interbase here? I'd like to ask to test the new > driver (firebirdsql). And automate testing with Firebird, if possible. Dr. Neil Muller implemented tests (thank you, Neil!) but alas all tests are failing with the same error: Dynamic SQL Error; SQL error code -104. It seems tests require more work to adapt to FB. Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2017-01-12 15:07:56
|
Thanks! On Thu, Jan 12, 2017 at 11:34:29AM -0300, "Gustavo A. D??az" <gus...@gm...> wrote: > Hi, > > Good interview! > > Cheers. > > -- > Gustavo A. D??az > GDNet - www.gdnet.com.ar > "Servicios TI para tus necesidades" > > 2017-01-09 11:57 GMT-03:00 Oleg Broytman <ph...@ph...>: > > > Hi! Vanity post: an interview with me at PyDev of the Week: > > > > http://www.blog.pythonlibrary.org/2017/01/09/pydev-of-the- > > week-oleg-broytman/ > > > > You can know me a lit bit better now. :-) Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Gustavo A. D. <gus...@gm...> - 2017-01-12 14:34:37
|
Hi, Good interview! Cheers. -- Gustavo A. Díaz GDNet - www.gdnet.com.ar "Servicios TI para tus necesidades" 2017-01-09 11:57 GMT-03:00 Oleg Broytman <ph...@ph...>: > Hi! Vanity post: an interview with me at PyDev of the Week: > > http://www.blog.pythonlibrary.org/2017/01/09/pydev-of-the- > week-oleg-broytman/ > > You can know me a lit bit better now. :-) > > Oleg. > -- > Oleg Broytman http://phdru.name/ ph...@ph... > Programmers don't die, they just GOSUB without RETURN. > > ------------------------------------------------------------ > ------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > _______________________________________________ > sqlobject-discuss mailing list > sql...@li... > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss > |
From: Oleg B. <ph...@ph...> - 2017-01-09 14:57:52
|
Hi! Vanity post: an interview with me at PyDev of the Week: http://www.blog.pythonlibrary.org/2017/01/09/pydev-of-the-week-oleg-broytman/ You can know me a lit bit better now. :-) Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2017-01-03 19:53:16
|
Happy New Year, everyone! Any user of Firebird/Interbase here? I'd like to ask to test the new driver (firebirdsql). And automate testing with Firebird, if possible. Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |