johnf wrote:
> On Friday 13 February 2009 04:53:17 pm Ricardo Aráoz wrote:
>   
>> johnf wrote:
>>     
>>> On Friday 13 February 2009 10:48:10 am Ricardo Aráoz wrote:
>>>       
>>>>>>> import pymssql
>>>>>>> pymssql.__version__
>>>>>>>               
>>>> '0.8.0'
>>>>
>>>>         
>>>>>>> conn = pymssql.connect(user='usr', password='pass', host='Host',
>>>>>>>               
>>>> database='DBase')
>>>>
>>>>         
>>>>>>> crsr = conn.cursor()
>>>>>>> dbName = u'tgestion'
>>>>>>> dbName
>>>>>>>               
>>>> u'tgestion'
>>>>
>>>>         
>>>>>>> crsr.execute("select table_name"
>>>>>>>               
>>>> ...             " from INFORMATION_SCHEMA.TABLES"
>>>> ...             " where table_catalog = %(db)s"
>>>> ...             " and table_type = 'BASE TABLE'"
>>>> ...             " order by table_name",
>>>> ...              {'db':dbName} )
>>>>         
>>> Please use the below code (from a command prompt) and tell me/ provide me
>>> with the output.   BTW please confirm that your host name is 'Host'.  If
>>> not use the IP address of where database server is (localhost,
>>> 192.168.1.230).
>>>
>>> import pymssql
>>>
>>> conn = pymssql.connect(user='usr',
>>> password='pass',host='Host',database='DBase')
>>> print conn
>>> crsr = conn.cursor()
>>> print crsr
>>> crsr.execute("select table_name from INFORMATION_SCHEMA.TABLES where
>>> table_catalog ='DBase' and table_type = 'BASE TABLE'  order by
>>> table_name" ) mytables =cur.fetchall()
>>> for tables in mytables:
>>>    print tables
>>>       
>> I'll run it on monday. But it will surely work all right. If you take a
>> look at my previous mail you'll see that :
>>
>> crsr.execute("select table_name from INFORMATION_SCHEMA.TABLES where
>> table_catalog ='%(db)s' and table_type = 'BASE TABLE'  order by table_name"
>> % {'db':dbName})
>>
>> worked ok today and this is practically the same than what you are asking
>> me to do.
>>     
>
> That's correct.  But I needed some code to start with.  So I decided it would 
> be a first step.  Then when that works we can start testing with some Dabo 
> code.
>
>   
Hi John, had some time and continued testing the class designer. So I
created in my netbook a sqlite database :
---------------------------------------------------------------------------------------------------------
import sqlite3
con = sqlite3.connect(dabo.ui.getFile())
cur = con.cursor()
cur.execute(""" create table tablasvs
                (tablasvsid int, nombre char(40), descripcion text)""")
cur.execute(u""" insert into tablasvs
                values (1, 'NombreTabla', 'Esto es una descripción larga')
            """)
cur.execute('select * from tablasvs')
for reg in cur :
    print reg
print reg[2]

    --------------------------------------------------------------
    (1, u'NombreTabla', u'Esto es una descripci\xf3n larga')
    Esto es una descripción larga
    --------------------------------------------------------------

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

Then call the class designer, "Add controls from data environment", in
comes the wizard, create a connection, tests ok, save it, select it in
the "Select a connection" textbox, click next and this error appears,
now this is not only the mssql module but also fails with the sqlite
module :
-----------------------------------------------------------------------------------------------------
Microsoft Windows XP [Versión 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Python25\Lib\site-packages\dabo\ide>python ClassDesigner.py
Traceback (most recent call last):
  File "C:\Python25\lib\site-packages\dabo\ui\uiwx\dControlMixin.py",
line 27, i
n _onWxHit
    self.raiseEvent(dEvents.Hit, evt, *args, **kwargs)
  File "C:\Python25\lib\site-packages\dabo\ui\uiwx\dPemMixin.py", line
944, in r
aiseEvent
    super(dPemMixin, self).raiseEvent(eventClass, nativeEvent, *args,
**kwargs)
  File "C:\Python25\lib\site-packages\dabo\lib\eventMixin.py", line 93,
in raise
Event
    bindingFunction(event)
  File "C:\Python25\lib\site-packages\dabo\ui\dialogs\Wizard.py", line
124, in o
nNext
    self.CurrentPage += pg.nextPage()
  File "C:\Python25\lib\site-packages\dabo\ui\dialogs\Wizard.py", line
291, in _
setCurrPage
    ok = self._pages[self._currentPage].onLeavePage(direction)
  File
"C:\Python25\Lib\site-packages\dabo\ide\wizards\QuickLayoutWizard.py", li
ne 63, in onLeavePage
    return self.Wizard.makeConnection()
  File
"C:\Python25\Lib\site-packages\dabo\ide\wizards\QuickLayoutWizard.py", li
ne 776, in makeConnection
    conn = self.Application.getConnectionByName(self.ConnectionName)
  File "C:\Python25\lib\site-packages\dabo\dApp.py", line 980, in
getConnectionB
yName
    self.dbConnections[connName] = dabo.db.dConnection(ci)
  File "C:\Python25\lib\site-packages\dabo\db\dConnection.py", line 32,
in __ini
t__
    self._connection = self._openConnection(**kwargs)
  File "C:\Python25\lib\site-packages\dabo\db\dConnection.py", line 77,
in _open
Connection
    return
self._connectInfo.getConnection(forceCreate=self._forceCreate, **kwar
gs)
  File "C:\Python25\lib\site-packages\dabo\db\dConnectInfo.py", line
105, in get
Connection
    return self._backendObject.getConnection(self, **kwargs)
  File "C:\Python25\lib\site-packages\dabo\db\dbSQLite.py", line 59, in
getConne
ction
    raise DBFileDoesNotExistException(_("Database file '%s' does not
exist") % p
th)
dabo.dException.DBFileDoesNotExistException: Database file 'mibase' does
not exi
st
--------------------------------------------------------------------------------------------------

My data :
-------------------------------------------------
Platform: Win
Python Version: 2.5.4 on win32
Dabo Version: Version 0.9.1; Revision ~5042
UI Version: 2.8.9.1 on wxMSW
-------------------------------------------------

The only thing I can say about the connection is that when I create it
and test it, the database file is r"D:\Desarrollo\Dabo\Prueba
sqlite3\mibase", but if I save it, get out of the connection editor, get
in again and open the connection again, then the database file is
"mibase" (no directory info). And in the xml the directory info does not
appear :
------------------------------
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<connectiondefs xmlns="http://www.dabodev.com";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://www.dabodev.com conn.xsd"
xsi:noNamespaceSchemaLocation = "http://dabodev.com/schema/conn.xsd";>

    <connection dbtype="SQLite">
        <name>mibase</name>
        <host></host>
        <database>mibase</database>
        <user></user>
        <password></password>
        <port></port>
    </connection>


</connectiondefs>
-------------------------------------------------------------------------

TIA



--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/[email protected]

Reply via email to