django-filemaker-pyodbc
A Django Custom Database Engine that works with Filemaker using pyodbc.
Initial components derived from https://github.com/lionheart/django-pyodbc. Using that package as a guide was very helpful.
Use with a little caution as some functions in some components are expecting a MS-SQL backend.
Those will be changed in due course as needed. Pull requests welcome.
Note that NO testing has been done as yet on migrations.
Our first use case was talking to an existing filemaker solution.
Example model. Note managed = False and db_table must match the table object name in the Filemaker Relationship Graph window.
\# -*- coding: utf-8 -*-
from \_\_future\_\_ import unicode_literals
from django.db import models
class Depot(models.Model):
id = models.IntegerField(primary_key=True,help_text='id',db_column='id')
uuid = models.UUIDField(null=True,blank=True,help_text='uuid',db_column='uuid',db_index=True,unique=True)
name = models.CharField(max_length=1024,null=True,help_text='134.13',db_column='depot_name',db_index=True)
filemaker_base_table_id = 134
def __str__(self):
return '%s id: %d' % (self.name, self.id)
class Meta:
db_table = 'depot'
managed = False
verbose_name = 'Depot'
verbose_name_plural = 'DepotList'
To use.
-
pip install django-filemaker-pyodbc -
Create an odbc connection to the Filemaker solution and test that the credentials work.
-
Add references to the Filemaker odbc library that unixodbc can see.
Example content within
/usr/local/etc/odbcinst.ini[filemaker]Driver = /Library/ODBC/FileMaker ODBC.bundle/Contents/MacOS/fmodbc.soDriverManagerEncoding=UTF-16Setup =To find where the settings are for unixodbc try
odbcinst -j -
Add your connection details to your settings.py file.
DATABASES = {
'default': {
'ENGINE': 'django_filemaker_pyodbc',
'HOST': 'fully qualified domain or ip address',
'PORT': '2399',
'USER': 'filemaker user account with odbc/jdbc permissions',
'PASSWORD': '********',
'NAME': 'filemaker file name without the extension - preferably without spaces',
'OPTIONS' : {
'driver' : 'filemaker',
'driver_supports_utf8' : True,
'autocommit' : True,
},
}
}
Note there are some tables that need to be installed into your Filemaker solution.
Filemaker SQL is a partial implementation of SQL 92 See Filemaker 16 SQL Reference for more details.
Versions:
• 0.0.13 Removed references to smart_text from operations.
• 0.0.12 Resolved issues with like queries.
• 0.0.11 Resolved issue with call to 'SAVE TRANSACTION' made by Django unittest. Filemaker SQL has no support for standard SQL transactions.
• 0.0.10 Remove Parameter Type Being Printed on Calls
• 0.0.9 Removed +00:00 from sql date as string parameters to handle Filemaker non time zone aware timestamps.
• 0.0.8 Removed debugging print statements. Added django-tables.xml Added django-tables.fmp12 Changed publish.sh to accept a command line parameter.
• 0.0.7 Resolved issue with selecting n+1 items in a list.
Relates to: 'DatabaseOperations' object has no attribute 'is_db2'.
https://taiga.bd2l.com.au/project/csmu-django-filemaker-pyodbc/issue/3
examples of code that showed the errer which is now resolved.
``'
rostertemplate___shiftshot = rostertemplate___shiftslot_list[5]
````
Added a sample django-tables.fmp12 file with the tables required for django to work with filemaker solutions.
Added django-tables.xml
Added django-tables.xml converted to JSON files within the django-table directory.
• 0.0.6 https://taiga.bd2l.com.au/project/csmu-depot-maestro/task/221
Add in django tables
Added support for creating insert sql on objects with a db_column attribute. We now can login via a django login into a Filemaker solution with the necessary supporting tables.
• 0.0.5 https://taiga.bd2l.com.au/project/csmu-depot-maestro/issue/197
'SQLCompiler' object has no attribute 'can_bulk' Added can_bulk to class SQLCompiler.
• 0.0.4
Resolved issues with SQL Insert statements. Added has_bulk_insert = False to features.
• 0.0.3
Removed dependencies requiring django_pyodbc to be installed.
Added support for autocommit with True as the default.
• 0.0.2
Resolved issue with clobbering str types as binary on save
• 0.0.1
Initial version
Release files for django-filemaker-pyodbc 0.0.13
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-filemaker-pyodbc-0.0.13.tar.gz | 24.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_filemaker_pyodbc-0.0.13-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 55.9 kB
Release files / django-filemaker-pyodbc-0.0.13.tar.gz
| Download URL | django-filemaker-pyodbc-0.0.13.tar.gz |
|---|---|
| Size | 24.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6bf5ed22a746806471d06c2e4f5dbcb64241d4c72977614e3000016f2d08de1c
|
|
BLAKE2b-256 checksum How to use checksums |
533789680028e9a61a23a455d39b654ebee26880704578be74dd9f84579d47c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.2 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.3
|
Release files / django_filemaker_pyodbc-0.0.13-py3-none-any.whl
| Download URL | django_filemaker_pyodbc-0.0.13-py3-none-any.whl |
|---|---|
| Size | 31.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
829e5618cc60c1992a67e218e13782d5b37a2bce6ba4419e1d730820a60c6268
|
|
BLAKE2b-256 checksum How to use checksums |
ca9925db7f2d8217f728fc322b3a444d561f85b545ac408df7d692647c6d531f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.2 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.3
|