I have a ClassWrapper that wraps around a third party database object.
Each database object has a set of properties, like columns in a
relational database.
I want my wrapper to generate a property for each database object and
load its value into it.
Thus, in my database (which is an oodbms) say I have a MyDbaseClass
with MyProperty1, MyProperty2, etc, after it is loaded, I have:
dbase_object = LoadMyDbaseClas s
PythonDbaseClas s = PythonWrapper(d base_object)
I can then load in a list of ['MyProperty1',' MyProperty2', etc].
But how can I turn these list elements into PythonDbaseClas s
properties, so that I could then simply have:
print PythonDbaseClas s.MyProperty1
PythonDbaseClas s.MyProperty2=" 4"
Is this clear? 6 1435
At Friday 8/12/2006 05:38, manstey wrote:
>Is this clear?
I'm sorry, not for me. Some code showing how things are used now and
how you would like it to be, would help.
--
Gabriel Genellina
Softlab SRL
_______________ _______________ _______________ _____
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar
manstey wrote:
I have a ClassWrapper that wraps around a third party database object.
Each database object has a set of properties, like columns in a
relational database.
I want my wrapper to generate a property for each database object and
load its value into it.
Thus, in my database (which is an oodbms) say I have a MyDbaseClass
with MyProperty1, MyProperty2, etc, after it is loaded, I have:
dbase_object = LoadMyDbaseClas s
PythonDbaseClas s = PythonWrapper(d base_object)
I can then load in a list of ['MyProperty1',' MyProperty2', etc].
But how can I turn these list elements into PythonDbaseClas s
properties, so that I could then simply have:
print PythonDbaseClas s.MyProperty1
PythonDbaseClas s.MyProperty2=" 4"
Is this clear?
Sounds as if you're reinventing a part of an ORM. Have you checked out
SQLAlchemy or Django's ORM, in case they provide what you want out of
the box ?
George
We've looked at them a little. Cache is a native OO dbase, so there is
no ORM required. Cache does that for you behind the scenes if you need
it to. What I want is to translate Cache classes and properties into
Python classes and properties. We can only use class wrappers, because
cache uses old style python objects, but this still works.
Because I am not an experienced programmer, the problem I face is how
to load ANY Cache class, whose properties the wrapper doesn't know in
advance, and turn the class properties into python properties.
So in Cache, I might have Name = String, Age = Integer, Colours = List,
in the class Person. The python binding provided by Cache creates a
Person class in Python, but it provides none of its properties, so I
want to write a wrapping class that adds the properties. Can you advise
me on how to do this?
Hi,
Cache is a pure OO dbase, so no ORM is required. Cache provides a
python equivalent for the Cache class, but not for the Cache
properties. Instead, the programmer has to know in advance the
properties and their type to get and set them. I want to wrap the
Python-cache class and add the Cache properties into the class, but I
don't know how to do this. Any ideas?
George Sakkis wrote:
manstey wrote:
I have a ClassWrapper that wraps around a third party database object.
Each database object has a set of properties, like columns in a
relational database.
I want my wrapper to generate a property for each database object and
load its value into it.
Thus, in my database (which is an oodbms) say I have a MyDbaseClass
with MyProperty1, MyProperty2, etc, after it is loaded, I have:
dbase_object = LoadMyDbaseClas s
PythonDbaseClas s = PythonWrapper(d base_object)
I can then load in a list of ['MyProperty1',' MyProperty2', etc].
But how can I turn these list elements into PythonDbaseClas s
properties, so that I could then simply have:
print PythonDbaseClas s.MyProperty1
PythonDbaseClas s.MyProperty2=" 4"
Is this clear?
Sounds as if you're reinventing a part of an ORM. Have you checked out
SQLAlchemy or Django's ORM, in case they provide what you want out of
the box ?
George
manstey wrote:
We've looked at them a little. Cache is a native OO dbase, so there is
no ORM required. Cache does that for you behind the scenes if you need
it to. What I want is to translate Cache classes and properties into
Python classes and properties. We can only use class wrappers, because
cache uses old style python objects, but this still works.
Because I am not an experienced programmer, the problem I face is how
to load ANY Cache class, whose properties the wrapper doesn't know in
advance, and turn the class properties into python properties.
So in Cache, I might have Name = String, Age = Integer, Colours = List,
in the class Person. The python binding provided by Cache creates a
Person class in Python, but it provides none of its properties, so I
want to write a wrapping class that adds the properties. Can you advise
me on how to do this?
I'm afraid not, at least not without seeing an example. By the way,
I've never heard of Cache before and its name is too generic for
looking it up online; you should at least provide a link if you're
asking for help about obscure packages.
George
On 8 dic, 20:59, "manstey" <mans...@csu.ed u.auwrote:
We've looked at them a little. Cache is a native OO dbase, so there is
no ORM required. Cache does that for you behind the scenes if you need
it to. What I want is to translate Cache classes and properties into
Python classes and properties. We can only use class wrappers, because
cache uses old style python objects, but this still works.
Because I am not an experienced programmer, the problem I face is how
to load ANY Cache class, whose properties the wrapper doesn't know in
advance, and turn the class properties into python properties.
So in Cache, I might have Name = String, Age = Integer, Colours = List,
in the class Person. The python binding provided by Cache creates a
Person class in Python, but it provides none of its properties, so I
want to write a wrapping class that adds the properties. Can you advise
me on how to do this?
Still unclear... Don't you have a way to iterate over all the
properties? Have you tried using dir() on the generated class?
BTW, do you know ZODB? It's an OO database written in Python and mostly
transparent for the user. You just write and use your objects as always
and the persistence mechanism does the rest.
--
Gabriel Genellina This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jon Slaughter |
last post by:
I have a class that is basicaly duplicated throughout several files with
only members names changing according to the class name yet with virtually
the exact same coding going on.
e.g.
class A
{
std::vector<B*> Bs;
public:
|
by: Baski |
last post by:
Base class:
class AssetBase
{
string _clli;
public string CLLI
{
get
|
by: David A. Osborn |
last post by:
I have a set of classes that each have an enumeration in them, and based on
dynamic input I need to access a different enumeration. For example
Three classes Class_A, Class_B, and Class_C that all have a different
enumeration in them called Properties. I want to basically have a variable
The_Class that I can dynamically point to either Class_A, Class_B, or
Class_C and then do The_Class.properties to get the correct enumeration.
How...
|
by: Simon Hart |
last post by:
Hi,
I am trying to implement some functionality as seen in MS CRM 3.0 whereby a
basic Xml is deserialized into an object which contains properties. What I
want to do from here is; cast the basic object into a more strongly typed
class which knows what properties to expect.
The basic top level class is as follows:
using System;
|
by: Per Bull Holmen |
last post by:
Hey
Im new to c++, so bear with me. I'm used to other OO languages, where it
is possible to have class-level initialization functions, that
initialize the CLASS rather than an instance of it. Like, for instance
the Objective-C method:
+(void)initialize
Which has the following characteristics: It is guaranteed to be run
| |
by: Rainer Queck |
last post by:
Hello NG,
Is it possible to share the settings of an application with a class
libreary?
In my case I have a application and a set of different reports (home made)
put into a class library.
The plan is to delivere different report.dlls with the main app.
But it is essentially importent, that the reports and the app use the same
settings.
|
by: David C. Ullrich |
last post by:
Having a hard time phrasing this in the form
of a question...
The other day I saw a thread where someone asked
about overrideable properties and nobody offered
the advice that properties are Bad. So maybe we've
got over that. I suppose properties could have
Bad consequences if a user doesn't know they exist
and think that a certain property of an object is
just an ordinary attribute. But that applies to
|
by: FullBandwidth |
last post by:
I have been perusing various blogs and MSDN pages discussing the use
of event properties and the EventHandlerList class. I don't believe
there's anything special about the EventHandlerList class in this
context, in fact some articles from pre-2.0 suggest using any
collection class of your choice. So my questions focus more on the
syntax of event properties provided by the "event" keyword in C#.
(Disclaimer - I am a C++ programmer working...
|
by: Josh Valino |
last post by:
Hi group,
Is there a way in C# (.Net 3.5 FW) for me to define an abstract class that
has some properties, and then in each derived class, select which properties
I'd like available and which ones I would not? I know that I can put the
properties that will be available in ALL derived classes in the base class
and then implement the others in the derived classes, but many of the
derived classes will share these properties. To illustrate:
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |