sqlobject-discuss Mailing List for SQLObject (Page 3)
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: Markus E. <Mar...@we...> - 2019-04-16 10:50:41
|
> No, I don't see a reason for a new class. New class could override > existing methods but we're talking about new method(s) so > why not add them just to SQLObject's main class? A command like “CREATE TABLE” belongs to the category “data definition language” within SQL. I would prefer then that corresponding classes will be loaded (or imported) only if the code for such functionality will be used at all finally. >>> SQLObject does some limited introspection. >> >> Would you like to improve the software situation in this area? Will the software documentation be extended also? Regards, Markus |
From: Markus E. <Mar...@we...> - 2019-04-16 10:50:41
|
> No, I don't see a reason for a new class. New class could override > existing methods but we're talking about new method(s) so > why not add them just to SQLObject's main class? A command like “CREATE TABLE” belongs to the category “data definition language” within SQL. I would prefer then that corresponding classes will be loaded (or imported) only if the code for such functionality will be used at all finally. >>> SQLObject does some limited introspection. >> >> Would you like to improve the software situation in this area? Will the software documentation be extended also? Regards, Markus |
From: Oleg B. <ph...@ph...> - 2019-04-16 09:57:20
|
On Tue, Apr 16, 2019 at 11:40:37AM +0200, Markus Elfring <Mar...@we...> wrote: > >> How do you think about the clarification for additional classes? > > > > Sorry, I don't understand. > > You indicated the possibility to add two methods directly > to the class ???SQLObject??? (as a design sketch). > Will it become more helpful to extend the corresponding class hierarchy? Ah, I see, tnx. No, I don't see a reason for a new class. New class could override existing methods but we're talking about new method(s) so why not add them just to SQLObject's main class? > > SQLObject does some limited introspection. > > Would you like to improve the software situation in this area? I'll be glad to accept pull requests or patches in any area in SQLObject. > > It can determine if a table exists[1] and get the list[2][3] of columns and joins. > > Such functionality might be sufficient for my data analysis needs > while I can get more concerned also about other software limitations > (or requirements). > > Can the name be automatically determined for a dynamically generated > database table? No. In SQLObject you have to have a name. You can generate the name dynamically or you can list tables[1] and filter the list. 1. https://github.com/sqlobject/sqlobject/blob/ed64be0ed032055b0a6613fe3051d83a74ded566/sqlobject/postgres/pgconnection.py#L525 > Regards, > Markus Oleg. -- Oleg Broytman https://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Markus E. <Mar...@we...> - 2019-04-16 09:40:51
|
>> How do you think about the clarification for additional classes? > > Sorry, I don't understand. You indicated the possibility to add two methods directly to the class “SQLObject” (as a design sketch). Will it become more helpful to extend the corresponding class hierarchy? > SQLObject does some limited introspection. Would you like to improve the software situation in this area? > It can determine if a table exists[1] and get the list[2][3] of columns and joins. Such functionality might be sufficient for my data analysis needs while I can get more concerned also about other software limitations (or requirements). Can the name be automatically determined for a dynamically generated database table? Regards, Markus |
From: Oleg B. <ph...@ph...> - 2019-04-16 09:19:37
|
On Tue, Apr 16, 2019 at 10:35:13AM +0200, Markus Elfring <Mar...@we...> wrote: > >> Will such software extensions become more feasible? > > > > Yes, I think so. > > Thanks for such positive feedback. Welcome! :-) > > The API perhaps would be simple, something like > > > > class SQLObject(...): > > @classmethod > > def createAsSelectSQL(cls, selectFrom): > > ... > > How do you think about the clarification for additional classes? Sorry, I don't understand. > > @classmethod > > def createAsSelect(cls, selectFrom): > > conn = connection or cls._connection > > query = cls.createAsSelectSQL(selectFrom) > > conn.query(query) > > > > where ``selectFrom`` is ``SelectResults`` instance. The method shod > > construct ``CREATE TABLE ... AS SELECT ...`` but it also must construct > > a list of columns (instances of ``col.Col`` classes) and call > > ``cls.sqlmeta.addColumn(columnDef)`` for every column in the list. > > Will the determination of involved data structures need any further > software design considerations? That can only be determined during design and implementation. > > And here I foresee a problem. It's possible to create a table in the > > database but how to recreate the class with all columns on the second > > run of the program or in another program that will use the class? > > Are you used to fiddle with database reflection (or introspection)? SQLObject does some limited introspection. It can determine if a table exists[1] and get the list[2][3] of columns and joins. 1. https://github.com/sqlobject/sqlobject/blob/ed64be0ed032055b0a6613fe3051d83a74ded566/sqlobject/main.py#L1471 2. http://sqlobject.org/SQLObject.html#automatic-class-generation 3. https://github.com/sqlobject/sqlobject/blob/ed64be0ed032055b0a6613fe3051d83a74ded566/sqlobject/postgres/pgconnection.py#L346 > Regards, > Markus Oleg. -- Oleg Broytman https://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Markus E. <Mar...@we...> - 2019-04-16 08:35:26
|
>> Will such software extensions become more feasible? > > Yes, I think so. Thanks for such positive feedback. > The API perhaps would be simple, something like > > class SQLObject(...): > @classmethod > def createAsSelectSQL(cls, selectFrom): > ... How do you think about the clarification for additional classes? > @classmethod > def createAsSelect(cls, selectFrom): > conn = connection or cls._connection > query = cls.createAsSelectSQL(selectFrom) > conn.query(query) > > where ``selectFrom`` is ``SelectResults`` instance. The method shod > construct ``CREATE TABLE ... AS SELECT ...`` but it also must construct > a list of columns (instances of ``col.Col`` classes) and call > ``cls.sqlmeta.addColumn(columnDef)`` for every column in the list. Will the determination of involved data structures need any further software design considerations? > And here I foresee a problem. It's possible to create a table in the > database but how to recreate the class with all columns on the second > run of the program or in another program that will use the class? Are you used to fiddle with database reflection (or introspection)? Regards, Markus |
From: Oleg B. <ph...@ph...> - 2019-04-13 18:22:07
|
On Sat, Apr 13, 2019 at 07:12:37PM +0200, Markus Elfring <Mar...@we...> wrote: > > Do you want to implement it? > > I guess that I am not familiar enough with corresponding software > design constraints (at the moment). > > Will such software extensions become more feasible? Yes, I think so. The API perhaps would be simple, something like class SQLObject(...): @classmethod def createAsSelectSQL(cls, selectFrom): ... @classmethod def createAsSelect(cls, selectFrom): conn = connection or cls._connection query = cls.createAsSelectSQL(selectFrom) conn.query(query) where ``selectFrom`` is ``SelectResults`` instance. The method shod construct ``CREATE TABLE ... AS SELECT ...`` but it also must construct a list of columns (instances of ``col.Col`` classes) and call ``cls.sqlmeta.addColumn(columnDef)`` for every column in the list. And here I foresee a problem. It's possible to create a table in the database but how to recreate the class with all columns on the second run of the program or in another program that will use the class? The code must recreate the list of columns again without executing ``CREATE TABLE AS SELECT`` query. Perhaps an API to produce a list of columns from ``selectFrom`` should be a separate API that could be called eve when the table is already exists. > Regards, > Markus Oleg. -- Oleg Broytman https://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Markus E. <Mar...@we...> - 2019-04-13 17:12:51
|
>> Do any of these classes trigger a table creation (CTAS command) >> which is automatically mapped to another Python object? > > No, not even ``CREATE TABLE``. And ``CREATE TABLE AS SELECT`` is not > implemented in SQLObject at all. Thanks for this clarification. > Do you want to implement it? I guess that I am not familiar enough with corresponding software design constraints (at the moment). Will such software extensions become more feasible? Regards, Markus |
From: Oleg B. <ph...@ph...> - 2019-04-13 17:06:11
|
On Sat, Apr 13, 2019 at 06:38:32PM +0200, Markus Elfring <Mar...@we...> wrote: > >> This software situation can look different if there are additional > >> abstractions involved because of object-relational mapping. > >> Can a query object be passed as a parameter for a corresponding method call? > > > > Certainly. Both SelectResults[1] and SQLBuilder[2]'s objects > > can be passed, they're just Python objects, no magic. > > > > 1. http://sqlobject.org/SelectResults.html > > 2. http://sqlobject.org/SQLBuilder.html > > Do any of these classes trigger a table creation (CTAS command) > which is automatically mapped to another Python object? No, not even ``CREATE TABLE``. And ``CREATE TABLE AS SELECT`` is not implemented in SQLObject at all. Do you want to implement it? > Regards, > Markus Oleg. -- Oleg Broytman https://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Markus E. <Mar...@we...> - 2019-04-13 16:38:54
|
>> This software situation can look different if there are additional >> abstractions involved because of object-relational mapping. >> Can a query object be passed as a parameter for a corresponding method call? > > Certainly. Both SelectResults[1] and SQLBuilder[2]'s objects > can be passed, they're just Python objects, no magic. > > 1. http://sqlobject.org/SelectResults.html > 2. http://sqlobject.org/SQLBuilder.html Do any of these classes trigger a table creation (CTAS command) which is automatically mapped to another Python object? Regards, Markus |
From: Oleg B. <ph...@ph...> - 2019-04-13 16:33:18
|
On Sat, Apr 13, 2019 at 06:19:40PM +0200, Markus Elfring <Mar...@we...> wrote: > >> Can the support be improved for the command variant ???CREATE TABLE AS SELECT??? (CTAS) > >> in this software area? > > > > How would you write that in Python? > > It could be written already if such a SQL command would be submitted to > a direct database programming interface. > This software situation can look different if there are additional > abstractions involved because of object-relational mapping. > Can a query object be passed as a parameter for a corresponding method call? Certainly. Both SelectResults[1] and SQLBuilder[2]'s objects can be passed, they're just Python objects, no magic. 1. http://sqlobject.org/SelectResults.html 2. http://sqlobject.org/SQLBuilder.html > Regards, > Markus Oleg. -- Oleg Broytman https://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Markus E. <Mar...@we...> - 2019-04-13 16:19:53
|
>> Can the support be improved for the command variant ???CREATE TABLE AS SELECT??? (CTAS) >> in this software area? > > How would you write that in Python? It could be written already if such a SQL command would be submitted to a direct database programming interface. This software situation can look different if there are additional abstractions involved because of object-relational mapping. Can a query object be passed as a parameter for a corresponding method call? Regards, Markus |
From: Oleg B. <ph...@ph...> - 2019-04-13 16:06:27
|
On Sat, Apr 13, 2019 at 05:08:48PM +0200, Markus Elfring <Mar...@we...> wrote: > > You can create a table using high-level API: > > > > http://sqlobject.org/SQLObject.html#declaring-the-class > > > > or you can execute ``CREATE TABLE`` directly. > > Can the support be improved for the command variant ???CREATE TABLE AS SELECT??? (CTAS) > in this software area? How would you write that in Python? > Regards, > Markus Oleg. -- Oleg Broytman https://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Markus E. <Mar...@we...> - 2019-04-13 15:09:09
|
> You can create a table using high-level API: > > http://sqlobject.org/SQLObject.html#declaring-the-class > > or you can execute ``CREATE TABLE`` directly. Can the support be improved for the command variant “CREATE TABLE AS SELECT” (CTAS) in this software area? Regards, Markus |
From: Oleg B. <ph...@ph...> - 2019-04-13 13:41:44
|
Hi! On Sat, Apr 13, 2019 at 02:46:31PM +0200, Markus Elfring <Mar...@we...> wrote: > Hello, > > I would like to count value combinations in database records together with > the software ???SQLObject 3.7.1???. > The computation result should be stored into a dynamically generated table. > I am curious how such table creation can be achieved by the programming > interface ???object-relational mapping??? currently. You can create a table using high-level API: http://sqlobject.org/SQLObject.html#declaring-the-class or you can execute ``CREATE TABLE`` directly. > Regards, > Markus Oleg. -- Oleg Broytman https://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Markus E. <Mar...@we...> - 2019-04-13 12:46:51
|
Hello, I would like to count value combinations in database records together with the software “SQLObject 3.7.1”. The computation result should be stored into a dynamically generated table. I am curious how such table creation can be achieved by the programming interface “object-relational mapping” currently. Regards, Markus |
From: Oleg B. <ph...@ph...> - 2019-02-02 16:37:33
|
Hello! I'm pleased to announce version 3.7.1, the first bugfix release of branch 3.7 of SQLObject. What's new in SQLObject ======================= Contributor for this release is Neil Muller. Bug fixes --------- * Fixed a unicode problem in the latest mysqlclient. Documentation ------------- * Exclude sqlmeta members from some of the api docs. The inclusion of of these sqlmeta members in these files breaks reproducible builds. Development ----------- * Source code was made flake8-clean using the latest flake8. CI -- * Run tests with Python 3.7. 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.org/project/SQLObject/3.7.1/ 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 https://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2018-06-06 16:41:51
|
Hello! I'm pleased to announce version 3.7.0, the first stable release of branch 3.7 of SQLObject. What's new in SQLObject ======================= Contributors for this release are Scott Stahl and Christophe Popov. Features -------- * Add signals on commit and rollback; pull request by Scott Stahl. Bug fixes --------- * Fix SSL-related parameters for MySQL-connector (connector uses a different param style). Bug reported by Christophe Popov. Drivers ------- * Remove psycopg1. Driver ``psycopg`` is now just an alias for ``psycopg2``. Tests ----- * Install psycopg2 from `psycopg2-binary`_ package. .. _`psycopg2-binary`: https://pypi.org/project/psycopg2-binary/ 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.org/project/SQLObject/3.7.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 https://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2018-02-24 16:30:13
|
Hello! I'm pleased to announce version 3.6.0, the first stable release of branch 3.6 of SQLObject. What's new in SQLObject ======================= Contributor for this release is Michael S. Root. Minor features -------------- * Close cursors after using to free resources immediately instead of waiting for gc. Bug fixes --------- * Fix for TypeError using selectBy on a BLOBCol. PR by Michael S. Root. Drivers ------- * Extend support for oursql and Python 3 (requires our fork of the driver). * Fix cursor.arraysize - pymssql doesn't have arraysize. * Set timeout for ODBC with MSSQL. * Fix _setAutoCommit for MSSQL. Documentation ------------- * Document extras that are available for installation. Build ----- * Use ``python_version`` environment marker in ``setup.py`` to make ``install_requires`` and ``extras_require`` declarative. This makes the universal wheel truly universal. * Use ``python_requires`` keyword in ``setup.py``. 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.6.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: Simon C. <hod...@gm...> - 2017-11-24 11:33:12
|
Yikes! Get well and thank you for all of your work on SQLObject. Schiavo Simon |
From: Oleg B. <ph...@ph...> - 2017-11-24 11:09:32
|
I'm ill and gonna spend a month in a hospital. Please help each other. Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2017-11-15 14:12:21
|
Hello! I'm pleased to announce version 3.5.0, the first stable release of branch 3.5 of SQLObject. What's new in SQLObject ======================= Contributors for this release are Shailesh Mungikar and Michael S. Root. Minor features -------------- * Add Python3 special methods for division to SQLExpression. Pull request by Michael S. Root. Drivers ------- * Add support for `pg8000 <https://pypi.python.org/pypi/pg8000>`_ PostgreSQL driver. * Fix autoreconnect with pymysql driver. Contributed by Shailesh Mungikar. Documentation ------------- * Remove generated HTML from eggs/wheels (docs are installed into wrong place). Generated docs are still included in the source distribution. Tests ----- * Add tests for PyGreSQL, py-postgresql and pg8000 at AppVeyor. * Fixed bugs in py-postgresql at AppVeyor. SQLObject requires the latest version of the driver from our fork. 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.5.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-10-24 20:33:43
|
On Tue, Oct 24, 2017 at 09:16:57PM +0100, Hugo Mills <hu...@ni...> wrote: > Hi, Oleg, > Thanks for the prompt reply. Welcome! > On Tue, Oct 24, 2017 at 09:37:57PM +0200, Oleg Broytman wrote: > > On Tue, Oct 24, 2017 at 08:00:13PM +0100, Hugo Mills <hu...@ni...> wrote: > > > 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. > > > > Probably yes (depends on the backend) but not with SQLObject. > > SQLObject can CREATE/DROP tables, columns and indices but cannot ALTER > > them. > > You need to execute ALTER TABLE connecting directly or call > > connection.execute("ALTER TABLE ...") > > > > What us your backend? MySQL? > > It's Postgres. If there's no other way than connection.execute(), Example: extend a column to 255 characters: ALTER TABLE tableName ALTER COLUMN columnName TYPE varchar(255); > then I've got no real problem with working that out. I was just hoping > that there was a less... raw approach. Alas! > Hugo. > Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Hugo M. <hu...@ni...> - 2017-10-24 20:17:21
|
Hi, Oleg, Thanks for the prompt reply. On Tue, Oct 24, 2017 at 09:37:57PM +0200, Oleg Broytman wrote: > On Tue, Oct 24, 2017 at 08:00:13PM +0100, Hugo Mills <hu...@ni...> wrote: > > 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. > > Probably yes (depends on the backend) but not with SQLObject. > SQLObject can CREATE/DROP tables, columns and indices but cannot ALTER > them. > You need to execute ALTER TABLE connecting directly or call > connection.execute("ALTER TABLE ...") > > What us your backend? MySQL? It's Postgres. If there's no other way than connection.execute(), then I've got no real problem with working that out. I was just hoping that there was a less... raw approach. Hugo. > > Thanks, > > Hugo. > > -- Dr Hugo Mills | hu...@ni... Chief Technologist | Nightglass Medical Rostering Ltd | +44 207 040 4054 |
From: Oleg B. <ph...@ph...> - 2017-10-24 20:00:01
|
Hi! On Tue, Oct 24, 2017 at 08:00:13PM +0100, Hugo Mills <hu...@ni...> wrote: > 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. Probably yes (depends on the backend) but not with SQLObject. SQLObject can CREATE/DROP tables, columns and indices but cannot ALTER them. You need to execute ALTER TABLE connecting directly or call connection.execute("ALTER TABLE ...") What us your backend? MySQL? > Thanks, > Hugo. > > -- > Dr Hugo Mills | hu...@ni... > Chief Technologist | > Nightglass Medical Rostering Ltd | +44 207 040 4054 Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |