hello folks,
is there any adjustment for table when change database connection? i have
define table that running fine on postgresql, mysql, sqlite (without any
modification when i change database connection), but sadly when tested on
sql server it throw me an error
*error :*
<class 'gluon.contrib.pypyodbc.ProgrammingError'> (u'42000', u"[42000]
[Microsoft][ODBC SQL Server Driver][SQL Server]Introducing FOREIGN KEY
constraint 'customer_created_by__constraint' on table 'customer' may cause
cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE
NO ACTION, or modify other FOREIGN KEY constraints.")
*my code on models\db.py*
## Use SQLite
#db = DAL('sqlite://testagain.sqlite', pool_size = 30, check_reserved =
['all'], migrate = True, lazy_tables = True)
## Use MySQL
# db = DAL('mysql://root:whateverpasswordyoulike@localhost/testagain',
pool_size = 30, check_reserved = ['all'], migrate = True, lazy_tables =
True)
## Use PostgreSQL
# db =
DAL('postgres://postgres:whateverpasswordyoulike@localhost/testagain',
pool_size = 30, check_reserved = ['all'], migrate = True, lazy_tables =
True)
from gluon.dal import MSSQLAdapter
if not (MSSQLAdapter.driver):
MSSQLAdapter.driver = globals().get('pyodbc',None)
db =
DAL('mssql://sa:whateverpasswordyoulike@localhost\SQLEXPRESS/testagain',
pool_size = 30, check_reserved = ['all'], migrate = True, lazy_tables =
True)
as you can see i just define the database connection (sqlite, postgresql,
mysql, sql server), i just test it running from empty database, yet only
sql server is return an error.
any suggestions or hints about creating table using sql server?
and another question is why i must explicit import sqlserver driver because
when i'm running web2py server it said :
Database drivers available: SQLite(sqlite3), MySQL(pymysql),
PostgreSQL(pg8000), MSSQL(pyodbc), DB2(pyodbc), Teradata(pyodbc),
Ingres(pyodbc), IMAP(imaplib)
as for sqlite, mysql and postgresql i didn't have to import the driver
thanks and best regards,
stifan
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.