MSSQL Driver

18 views
Skip to first unread message

Thijs Maenhout

unread,
Mar 30, 2021, 11:07:02 AM3/30/21
to peewee-orm
Hi,

I'm trying to implement an MSSQL driver through ZXJDBC in jython 2.7.2.  in Pewee 3.0

I'm already able to create a connection and check existance of tables, but I'm somehow stuck on how to implement a custom SchemaManager for this specific SQL dialect.

The _create_table in peewee.SchemaManager is not compliant to the MSSQL SQL dialect so I neew to override this.  What is the best way to do this?  Should I register this custom SchemaManager in the Custom Database class ?

Thanks for any insights, I really appreciate this.

Congratz with your wonderfull library, I love it.


Charles Leifer

unread,
Mar 30, 2021, 11:34:57 AM3/30/21
to peewe...@googlegroups.com
I'm not too sure how to advise as I'm not up on the differences. Any differences in the specification of column data-types would be handled elsewhere (DatabaseClass.field_types overrides). If the create table query structure is very different then, yeah, you probably need a custom SchemaManager.

Sorry not to be of much help, I have never used MSSQL before.

--
You received this message because you are subscribed to the Google Groups "peewee-orm" group.
To unsubscribe from this group and stop receiving emails from it, send an email to peewee-orm+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/peewee-orm/df2f080e-db23-4309-8f73-083fd8a09ad2n%40googlegroups.com.

Thijs Maenhout

unread,
Mar 31, 2021, 1:57:23 AM3/31/21
to peewee-orm
Hi Charles,

Thank you for your remarks.

One more question though, how should I  register my custom SchemaManager ?  Should I make a custom Model?  Or is it possible to register this in my custom DatabaseClass?

Kind regards,
Thijs


Op dinsdag 30 maart 2021 om 17:34:57 UTC+2 schreef Charles:

Charles Leifer

unread,
Mar 31, 2021, 8:46:07 AM3/31/21
to peewe...@googlegroups.com
You can create a base model class and inherit from it:

class MyBaseModel(Model):
    class Meta:
        schema_manager_class = MSSQLSchemaManager

Reply all
Reply to author
Forward
0 new messages