Giter Club home page Giter Club logo

django-firebird's Introduction

django-firebird

image

Firebird SQL backend for django

Repo Note: The master branch is an in development version of django-firebird. This may be substantially different from the latest release of django-firebird

This version of django-firebird is working with fbd [1], therefore it will work only with firebird 2.x and later. The stable version corresponds with django 2.2 and live into stable/2.2.x branch. The current master branch of this repository is being developed under django 3.x. For previous Django stable version check the branch list of this repository. fbd is the official stable python-firebird driver, also it has support for python 3.

[1] http://pypi.python.org/pypi/fdb/

Requirements

Installation

Using pip

pip install django-firebird

From repository

git clone git://github.com/maxirobaina/django-firebird.git

cd django-firebird

sudo python setup.py install

Manual Installation

Instructions for Ubuntu/Debian I assume you have installed django from source with python setup.py install

cd /usr/local/lib/python3.8/dist-packages

sudo git clone git://github.com/maxirobaina/django-firebird.git

sudo ln -s django-firebird/firebird firebird

cd /usr/local/lib/python3.8/dist-packages/django/db/backends

sudo ln -s /usr/local/lib/python3.8/dist-packages/django-firebird/firebird

Configuration

Modify your setting.py :

DATABASES = {
    'default': {
        'ENGINE' : 'django.db.backends.firebird',
        'NAME' : '/var/lib/firebird/3.0/data/django_firebird.fdb', # Path to database or db alias
        'USER' : 'SYSDBA',           # Your db user
        'PASSWORD' : '*****',    # db user password
        'HOST' : '127.0.0.1',        # Your host machine
        'PORT' : '3050',             # If is empty, use default 3050
        #'OPTIONS' : {'charset':'ISO8859_1'}
    }
}

Known bugs and issues

  • Some database migrations doesn't work by default. Sometimes is better make intermediate migrations for solve problems.
  • Some Query Expressions doesn't work by default. We need to make some workaround, ie: Use Cast().
  • Combined duration expressions need more research. No all combination of expressions works.

Contributing

Code and issues is in GitHub:

https://github.com/maxirobaina/django-firebird

We also have a mailing list:

http://groups.google.com/group/django-firebird-dev

django-firebird's People

Contributors

bawr avatar brunoprograma avatar dependabot[bot] avatar felixxm avatar ilizaran avatar lucasxvirtual1 avatar mariuz avatar maxirobaina avatar toninhonunes avatar toshiroakio avatar tsouvarev avatar vasiliy-yashkov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-firebird's Issues

DatabaseError is not indexable

Using python 3.2 with django 1.5.1, I am getting DatabseError is not indexable in firebird/base.py.

Affected lines are:
156: if e[0] in self.codes_for_integrityerror:
162: if e[0] in self.codes_for_integrityerror:
182: return tuple([e[0], '%s -- %s' % (e[1], q % tuple(p))])

changing to the following fixes the issue:
156: if e.args[0] in self.codes_for_integrityerror:
162: if e.args[0] in self.codes_for_integrityerror:
182: return tuple([e.args[0], '%s -- %s' % (e.args[1], q % tuple(p))])

Exception Type:NotImplementedError

Whe i follow Blog Posts in the admin area
http://mariuz.android-dev.ro/admin/blog/blogpost/

of Mezzanine 3.0.x and django 1.6.2

I get this error

Exception Type:NotImplementedError
Exception Location:/usr/local/lib/python2.7/dist-packages/django/db/backends/init.py
in datetime_trunc_sql, line 764

seems to be in

connection.ops.datetime_trunc_sql(self.lookup_type, col, self.tzname)
/usr/local/lib/python2.7/dist-packages/django/db/models/sql/datastructures.py

ps: the previous error was solved ๐Ÿ‘

ins

Hello, do you know what's happening? and as I do to fix it

(sigma)cfpp@cfpp-notebook:~/sigma/src$ manage inspectdb > models.py
Traceback (most recent call last):
File "/home/cfpp/sigma/src/manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/home/cfpp/sigma/local/lib/python2.7/site-packages/django/core/management/init.py", line 399, in execute_from_command_line
utility.execute()
File "/home/cfpp/sigma/local/lib/python2.7/site-packages/django/core/management/init.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/cfpp/sigma/local/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(_args, *_options.dict)
File "/home/cfpp/sigma/local/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
output = self.handle(_args, *_options)
File "/home/cfpp/sigma/local/lib/python2.7/site-packages/django/core/management/base.py", line 415, in handle
return self.handle_noargs(**options)
File "/home/cfpp/sigma/local/lib/python2.7/site-packages/django/core/management/commands/inspectdb.py", line 27, in handle_noargs
for line in self.handle_inspection(options):
File "/home/cfpp/sigma/local/lib/python2.7/site-packages/django/core/management/commands/inspectdb.py", line 40, in handle_inspection
cursor = connection.cursor()
File "/home/cfpp/sigma/local/lib/python2.7/site-packages/django/db/backends/init.py", line 160, in cursor
cursor = self.make_debug_cursor(self._cursor())
File "/home/cfpp/sigma/local/lib/python2.7/site-packages/django/db/backends/init.py", line 132, in _cursor
self.ensure_connection()
File "/home/cfpp/sigma/local/lib/python2.7/site-packages/django/db/backends/init.py", line 127, in ensure_connection
self.connect()
File "/home/cfpp/sigma/local/lib/python2.7/site-packages/django/db/utils.py", line 99, in exit
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/home/cfpp/sigma/local/lib/python2.7/site-packages/django/db/backends/init.py", line 127, in ensure_connection
self.connect()
File "/home/cfpp/sigma/local/lib/python2.7/site-packages/django/db/backends/init.py", line 115, in connect
self.connection = self.get_new_connection(conn_params)
File "/home/cfpp/sigma/local/lib/python2.7/site-packages/firebird/base.py", line 126, in get_new_connection
return Database.connect(**conn_params)
File "/home/cfpp/sigma/local/lib/python2.7/site-packages/fdb/fbcore.py", line 693, in connect
"Error while connecting to database:")
django.db.utils.DatabaseError: ('Error while connecting to database:\n- SQLCODE: -922\n- file /var/lib/firebird/2.5/data/sigma.fdb is not a valid database', -922, 335544323)

Django 1.8 not supported

Here what i have

Django==1.8
django-firebird===1.6.1.final.0
fdb==1.4.4

Query causes an error:

'firebird' isn't an available database backend.
Try using 'django.db.backends.XXX', where XXX is one of:
    u'base', u'mysql', u'oracle', u'postgresql_psycopg2', u'sqlite3'
Error was: cannot import name BaseDatabaseOperations

FirebirdCursorWrapper: missing exception info

In the FirebirdCursorWrapper class, on execute and executemany there is a lost of error info on exception.
The error_info method changes the standard on exception format data, and makes impossible the introspection information.
We need to have, error message, sqlcode and error code. SQL text and params is a plus.

inspectdb doesn`t work

When use inspected, only create this:

class VendaPedidoItens(models.Model):
class Meta:
db_table = u'venda_pedido_itens'

doesn`t create the Fields

Error when extract exception info (fdb related bug)

FDB (version 1.4.7) raise exception in two different ways, It raise an exception using "exception_from_status" function or using a standard exception class, for example ProgrammingError.

Depends on which approach fdb uses, the exception information changes. If it uses exception_from_status, the exception include: error message, sqlcode and error_code, If not, using ProgrammingError just the error message is included.

In the FirebirdCursorWrapper class the error_info method try to customize the exception info and make this more homogeneous (including sql statement and params if any), but it fails if exception_from_status is not used.

For example:

File "/home/chase/.virtualenvs/.../local/lib/python2.7/site-packages/firebird/base.py", line 241, in error_info
return tuple([e.args[0], e.args[1], e.args[2], {'sql': sql_text, 'params': p}])

IndexError: tuple index out of range

e.args[2] doesn't exists if ProgrammingError is raised

e.args[0] = Exception message
e.args[1] = sql_code
e.args[2] = error_code

AttributeError: 'DatabaseWrapper' object has no attribute 'Database'

Hello everyone,

I'm trying to integrate a firebird legacy database with my postgres database using this amazing project, but, during the tests, I've got the error AttributeError: 'DatabaseWrapper' object has no attribute 'Database'.

The model was mapped from an existing table:

class Equipment(models.Model):

    class Meta:
        managed = False
        db_table = '...'

    objects = EquipmentManager()

    id = models.IntegerField(db_column='...', primary_key=True)
    description = models.CharField(db_column='...', max_length=60)
    situation = models.CharField(db_column='...', max_length=1)


class EquipmentManager(models.Manager):

    def get_query_set(self):
        return super(EquipmentManager, self).get_query_set().filter(
            situation='A')

# This code raises the error
>>> for e in Equipment.objects.all(): print e.id, e.description

I tried with Meta.managed = True and custom Manager with same results.

I imagine that this error is hiding another one. What we can do about it?

Thanks.

litlle Problem with install

sorry i'm newbie, if I install with 'pip install djano-firebird' it works ok. but I think that doesn't install your latest version.

but if I tried to manual install with

git clone git://github.com/maxirobaina/django-firebird.git
cd django-firebird
sudo python setup.py install

I get this

Traceback (most recent call last):
File "setup.py", line 14, in <module>
version = __import__('firebird').get_version()
AttributeError: 'module' object has no attribute 'get_version'

is normal? or I'm doing things wrong.
I tried with a python2.7 or with a mkvirtualenv with python3.4

thanks in advance.

Is this driver Python 3 compatible?

Hi,

I am trying to use this driver with Python 3.3 but get syntax errors when I try to install it with pip.

Is it Python 3 compatible or do you have plans for a Python 3 version?

Regards

DatabaseIntrospection: get_relations implementation change in 1.8

In previous django version < 1.8, get_relation method had the following implementation

Returns a dictionary of {field_index: (field_index_other_table, other_table)}
representing all relationships to the given table. Indexes are 0-based.

Now, it changes to

Returns a dictionary of {field_name: (field_name_other_table, other_table)}
representing all relationships to the given table.

So, database introspections test fails.

Update operations.py

Update operations.py to support django 1.9

  • Implement datetime_cast_date_sql
  • Check implementation of year_lookup_bounds_for_date_field (May be no need anymore)
  • Check implementation of year_lookup_bounds_for_datetime_field (year_lookup_bounds doesn't exists anymore?)
  • value_to_db_... methods were replaced for adapt_..._value
    Ej: value_to_db_datetime now is adapt_datetimefield_value

Check more info at https://docs.djangoproject.com/es/1.9/releases/1.9/#database-backend-api

DatabaseWrapper object

Hi, i'm using win7, python 2.7, firebird 2.1.2, django 1.5.2, fdb 1.4, django-firebird 1.6.0 alpha, and I receive an error, DatabaseWrapper object has no attribute '_cursor'.
What i'm doing wrong? Thank's a lot!

Question.

Have used Django in the past, but not recently - thanks for undertaking this project! It is something we Firebird users are really excited about. Or should be, if we haven't heard about it yet.

Where is the appropriate place to watch for questions and answers about this nice project? Am I in the right place?

DatabaseOperations: repleace convert_values by get_db_converters

DatabaseOperations change convert_values method by get_db_converters and convert_{fieldtype}_value related methods.

For example: convert_booleanfield_value

def convert_booleanfield_value(self, value, expression, connection, context):
        if value in (0, 1):
            value = bool(value)
        return value

Fail to catch foreing key errors

The execute method of FirebirdCursorWrapper doesn't catch violation on foreign key constraints (error code -530) as integrity error

Error: The location of Firebird Client Library could not be determined.

I'm trying to run the lib on flynn.io (a alternative to heroku) that use buildpacks.

I'm using multi buildpack with .buildpacks like:

https://github.com/ddollar/heroku-buildpack-apt
https://github.com/heroku/heroku-buildpack-python

The heroku-buildpack-apt is used to install libfbclient2. The buildpack install it at /app/.apt/usr/lib/x86_64-linux-gnu, but after get the error, I found that the fdb python module doesn't look at LD_LIBRARY_PATH where the ".apt" folder is inserted.

How can I point to django-firebird an additional location (.apt folder, in case) to avoid the error?

django-firebird 1.7 not working with firebird 2.5.1 and django 1.7 for non-default firebird port.

Hi!
I'm using the following setup (all installed with pip install):
Django (1.7.11)
django-firebird (1.7)
fdb (1.6)

I connect to firebird database with gui razorsql and I connect successfully with this line:
jdbc:firebirdsql://test.testdomain.com:18006/DBtest (I changed a bit domain and port, and of course there are also user/password)

I have clean django project created by django 1.7.11 with this modification:

DATABASES = {
    'default': {
        'ENGINE' : 'firebird',
        'NAME' : 'DBtest', # Path to database or db alias
        'USER' : 'user',           # Your db user
        'PASSWORD' : '*****',    # db user password
        'HOST' : 'test.testdomain.com',        # Your host machine
        'PORT' : '18006',             # If is empty, use default 3050
    }
}

(of course with right user and password)

When I launch server (python manage.py runserver) nothing happens.

python manage.py runserver
Performing system checks...

System check identified no issues (0 silenced).

when I launch it with deafult sqlite generated settings:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}

default launching happens:

python manage.py runserver
Performing system checks...

System check identified no issues (0 silenced).

You have unapplied migrations; your app may not work properly until they are applied.
Run 'python manage.py migrate' to apply them.

April 20, 2016 - 13:55:50
Django version 1.7.11, using settings 'demofb.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

So smth is wrong with firebird database setup. But what? Maybe I should use different combination of versions?

Support for firebird 3

Hi There,
While testing with firebird 3 - suppose alter table etc. should be used instead...
UPDATE operation is not allowed for system table RDB$RELATION_FIELDS
pls let me know if more info is required - see below
Many thanks,
dvt

$ python3 manage.py migrate
Operations to perform:
Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
Applying admin.0001_initial... OK
Applying admin.0002_logentry_remove_auto_add... OK
Applying contenttypes.0002_remove_content_type_name...Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python3.5/dist-packages/django_firebird-1.9a0-py3.5.egg/firebird/base.py", line 236, in execute
return self.cursor.execute(q, params)
File "/usr/local/lib/python3.5/dist-packages/fdb/fbcore.py", line 3576, in execute
self._ps._execute(parameters)
File "/usr/local/lib/python3.5/dist-packages/fdb/fbcore.py", line 3291, in _execute
"Error while executing SQL statement:")
fdb.fbcore.DatabaseError: ('Error while executing SQL statement:\n- SQLCODE: -902\n- UPDATE operation is not allowed for system table RDB$RELATION_FIELDS', -902, 335545030)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "manage.py", line 22, in
execute_from_command_line(sys.argv)
File "/usr/lib/python3/dist-packages/django/core/management/init.py", line 367, in execute_from_command_line
utility.execute()
File "/usr/lib/python3/dist-packages/django/core/management/init.py", line 359, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/lib/python3/dist-packages/django/core/management/base.py", line 294, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/lib/python3/dist-packages/django/core/management/base.py", line 345, in execute
output = self.handle(*args, **options)
File "/usr/lib/python3/dist-packages/django/core/management/commands/migrate.py", line 204, in handle
fake_initial=fake_initial,
File "/usr/lib/python3/dist-packages/django/db/migrations/executor.py", line 115, in migrate
state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
File "/usr/lib/python3/dist-packages/django/db/migrations/executor.py", line 145, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File "/usr/lib/python3/dist-packages/django/db/migrations/executor.py", line 244, in apply_migration
state = migration.apply(state, schema_editor)
File "/usr/lib/python3/dist-packages/django/db/migrations/migration.py", line 129, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File "/usr/lib/python3/dist-packages/django/db/migrations/operations/fields.py", line 204, in database_forwards
schema_editor.alter_field(from_model, from_field, to_field)
File "/usr/lib/python3/dist-packages/django/db/backends/base/schema.py", line 495, in alter_field
old_db_params, new_db_params, strict)
File "/usr/local/lib/python3.5/dist-packages/django_firebird-1.9a0-py3.5.egg/firebird/schema.py", line 262, in _alter_field
self.execute(sql, params)
File "/usr/local/lib/python3.5/dist-packages/django_firebird-1.9a0-py3.5.egg/firebird/schema.py", line 404, in execute
cursor.execute(sql, params)
File "/usr/lib/python3/dist-packages/django/db/backends/utils.py", line 79, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "/usr/lib/python3/dist-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/usr/lib/python3/dist-packages/django/db/utils.py", line 94, in exit
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/usr/lib/python3/dist-packages/django/utils/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/usr/lib/python3/dist-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python3.5/dist-packages/django_firebird-1.9a0-py3.5.egg/firebird/base.py", line 236, in execute
return self.cursor.execute(q, params)
File "/usr/local/lib/python3.5/dist-packages/fdb/fbcore.py", line 3576, in execute
self._ps._execute(parameters)
File "/usr/local/lib/python3.5/dist-packages/fdb/fbcore.py", line 3291, in _execute
"Error while executing SQL statement:")
django.db.utils.DatabaseError: ('Error while executing SQL statement:\n- SQLCODE: -902\n- UPDATE operation is not allowed for system table RDB$RELATION_FIELDS', -902, 335545030)

inspectdb don't work

(sigma)cfpp@cfpp-notebook:~/sigma/src$ manage inspectdb
Traceback (most recent call last):
File "/home/cfpp/sigma/src/manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/home/cfpp/sigma/local/lib/python2.7/site-packages/django/core/management/init.py", line 399, in execute_from_command_line
utility.execute()
File "/home/cfpp/sigma/local/lib/python2.7/site-packages/django/core/management/init.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/cfpp/sigma/local/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(_args, *_options.dict)
File "/home/cfpp/sigma/local/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
output = self.handle(_args, *_options)
File "/home/cfpp/sigma/local/lib/python2.7/site-packages/django/core/management/base.py", line 415, in handle
return self.handle_noargs(**options)
File "/home/cfpp/sigma/local/lib/python2.7/site-packages/django/core/management/commands/inspectdb.py", line 27, in handle_noargs
for line in self.handle_inspection(options):
File "/home/cfpp/sigma/local/lib/python2.7/site-packages/django/core/management/commands/inspectdb.py", line 40, in handle_inspection
cursor = connection.cursor()
File "/home/cfpp/sigma/local/lib/python2.7/site-packages/django/db/backends/init.py", line 160, in cursor
cursor = self.make_debug_cursor(self._cursor())
File "/home/cfpp/sigma/local/lib/python2.7/site-packages/django/db/backends/init.py", line 132, in _cursor
self.ensure_connection()
File "/home/cfpp/sigma/local/lib/python2.7/site-packages/django/db/backends/init.py", line 127, in ensure_connection
self.connect()
File "/home/cfpp/sigma/local/lib/python2.7/site-packages/django/db/backends/init.py", line 115, in connect
self.connection = self.get_new_connection(conn_params)
File "/home/cfpp/sigma/local/lib/python2.7/site-packages/firebird/base.py", line 126, in get_new_connection
return Database.connect(**conn_params)
File "/home/cfpp/sigma/local/lib/python2.7/site-packages/fdb/fbcore.py", line 645, in connect
load_api()
File "/home/cfpp/sigma/local/lib/python2.7/site-packages/fdb/fbcore.py", line 176, in load_api
setattr(sys.modules[name],'api',fbclient_API())
File "/home/cfpp/sigma/local/lib/python2.7/site-packages/fdb/ibase.py", line 1155, in init
self.isc_attach_database = fb_library.isc_attach_database
File "/usr/lib/python2.7/ctypes/init.py", line 378, in getattr
func = self.getitem(name)
File "/usr/lib/python2.7/ctypes/init.py", line 383, in getitem
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: python: undefined symbol: isc_attach_database

manage.py dbshell fails on Linux

./manage dbshell fails on Linux platforms
The command line, Interactive SQL, on Linux is "isql-fb"
Current version is using "isql"

Introspection of boolean field type fail

The backend engine fails to introspect boolean fields type. It must be represented by SmallInt data type.

Implement the new introspected_boolean_field_type in DatabaseFeatures

TypeError: _alter_column_type_sql() takes exactly 5 arguments (4 given)

ERROR: test_rename (schema.tests.SchemaTests)

Traceback (most recent call last):
File "/home/maxi/projects/django/django-firebird/forks/github/django-firebird/tests/test_main/schema/tests.py", line 393, in test_rename
strict=True,
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/schema.py", line 470, in alter_field
self._alter_field(model, old_field, new_field, old_type, new_type, old_db_params, new_db_params, strict)
File "/usr/local/lib/python2.7/dist-packages/firebird/schema.py", line 138, in _alter_field
fragment, other_actions = self._alter_column_type_sql(model._meta.db_table, new_field.column, new_type)
TypeError: _alter_column_type_sql() takes exactly 5 arguments (4 given)

Database introspection: fdb schema api

Evaluante replace plain sql schema introspection by fdb schema api.

http://pythonhosted.org//fdb/usage-guide.html#working-with-database-schema

Working with database schema
Description of database objects like tables, views, stored procedures, triggers or UDF functions that represent database schema is stored in set of system tables present in every database. Firebird users can query these tables to get information about these objects and their relations. But querying system tables is inconvenient, as it requires good knowledge how this information is structured and requires significant amount of Python code. Changes in system tables between Firebird versions further add to this complexity. Hence FDB provides set of classes (isolated in separate module fdb.schema) that transform information stored in system tables into set of Python objects that surface the vital information in meaningful way, and additionaly provide set of methods for most commonly used operations or checks.

Number of available positional arguments to "sql_for_inline_foreign_key_references()"

Hello.

I'm trying to complete Django tutorial using a Firebird DB, on the following configuration: Windows 8.1, Python 2.7.6, Django 1.6.2. Fdb 1.4, django-firebird 1.5.3.final.0.

When I try "syncdb" I get the following error:

Creating tables ...
Traceback (most recent call last):
  File "C:\Users\amira_000\eclipse-wks\PythonProjects\StartProjectFDB\src\manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Users\amira_000\virtualenv\vePy27\lib\site-packages\django\core\management\__init__.py", line 399, in execute_from_command_line
    utility.execute()
  File "C:\Users\amira_000\virtualenv\vePy27\lib\site-packages\django\core\management\__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Users\amira_000\virtualenv\vePy27\lib\site-packages\django\core\management\base.py", line 242, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "C:\Users\amira_000\virtualenv\vePy27\lib\site-packages\django\core\management\base.py", line 285, in execute
    output = self.handle(*args, **options)
  File "C:\Users\amira_000\virtualenv\vePy27\lib\site-packages\django\core\management\base.py", line 415, in handle
    return self.handle_noargs(**options)
  File "C:\Users\amira_000\virtualenv\vePy27\lib\site-packages\django\core\management\commands\syncdb.py", line 96, in handle_noargs
    sql, references = connection.creation.sql_create_model(model, self.style, seen_models)
  File "C:\Users\amira_000\virtualenv\vePy27\lib\site-packages\django\db\backends\creation.py", line 83, in sql_create_model
    model, f, known_models, style)
TypeError: sql_for_inline_foreign_key_references() takes exactly 4 arguments (5 given)

This is exactly the same as the following bug for Python's MySql connector.
http://bugs.mysql.com/bug.php?id=71229

Truth is, I don't know whether I'd rather fill this issue in FDB project.

BinaryField: save streamed BLOB doesn't work

The test on BinaryField fails saving binary data.

Example:

class DataModel(models.Model):
    short_data = models.BinaryField(max_length=10, default=b'\x08')
    data = models.BinaryField()

from django.utils import six
from model_fields.models import *

binary_data = b'\x00\x46\xFE'

data_set = (binary_data, six.memoryview(binary_data))

for bdata in data_set:
... print bdata
... dm = DataModel(data=bdata)
... dm.save()

This generate

INSERT INTO "MODEL_FIELDS_DATAMODEL" ("SHORT_DATA", "DATA") VALUES (%s, %s) RETURNING "MODEL_FIELDS_DATAMODEL"."ID"
 ('\x08', <read-only buffer for 0x97293c8, size -1, offset 0 at 0x9730da0>)

Traceback (most recent call last): (splited)
File "/usr/local/lib/python2.7/dist-packages/fdb/fbcore.py", line 3574, in execute
self._ps._execute(parameters)
File "/usr/local/lib/python2.7/dist-packages/fdb/fbcore.py", line 3258, in _execute
self.__Tuple2XSQLDA(self._in_sqlda, parameters)
File "/usr/local/lib/python2.7/dist-packages/fdb/fbcore.py", line 3119, in __Tuple2XSQLDA
blob = ctypes.create_string_buffer(value)
File "/usr/lib/python2.7/ctypes/init.py", line 68, in create_string_buffer
raise TypeError(init)
TypeError: F๏ฟฝ

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.