GithubHelp home page GithubHelp logo

devkral / rdflib-django3 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from publysher/rdflib-django

5.0 5.0 4.0 176 KB

An implementation of the RDFlib Store API that uses Django for its backend.

License: MIT License

Python 100.00%

rdflib-django3's People

Contributors

devkral avatar gtoffoli avatar jgonggrijp avatar publysher avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

rdflib-django3's Issues

tests fail because of python 3.7

The tests fail because python 3.7 is not available yet on travis.

Option 1: waiting till travis supports 3.7.
Option 2: allow failures with 3.7

Broken migration

I'm using a Python 3.4.9_1 virtualenv with Django 1.11.18 and rdflib 4.2.2 in which I installed rdflib-django3 version 0.2.3. I added 'rdflib_django' to the INSTALLED_APPS setting. When trying to run the migrations, I got the following output:

$ python manage.py migrate
  Applying rdflib_django.0001_initial... OK
  Applying rdflib_django.0002_auto_20181112_1317...Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File ".env/lib/python3.4/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File ".env/lib/python3.4/site-packages/django/core/management/__init__.py", line 356, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File ".env/lib/python3.4/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File ".env/lib/python3.4/site-packages/django/core/management/base.py", line 330, in execute
    output = self.handle(*args, **options)
  File ".env/lib/python3.4/site-packages/django/core/management/commands/migrate.py", line 204, in handle
    fake_initial=fake_initial,
  File ".env/lib/python3.4/site-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 ".env/lib/python3.4/site-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 ".env/lib/python3.4/site-packages/django/db/migrations/executor.py", line 244, in apply_migration
    state = migration.apply(state, schema_editor)
  File ".env/lib/python3.4/site-packages/django/db/migrations/migration.py", line 129, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File ".env/lib/python3.4/site-packages/django/db/migrations/operations/fields.py", line 221, in database_forwards
    schema_editor.alter_field(from_model, from_field, to_field)
  File ".env/lib/python3.4/site-packages/django/db/backends/base/schema.py", line 531, in alter_field
    old_db_params, new_db_params, strict)
  File ".env/lib/python3.4/site-packages/django/db/backends/postgresql/schema.py", line 112, in _alter_field
    new_db_params, strict,
  File ".env/lib/python3.4/site-packages/django/db/backends/base/schema.py", line 634, in _alter_field
    old_default = self.effective_default(old_field)
  File ".env/lib/python3.4/site-packages/django/db/backends/base/schema.py", line 245, in effective_default
    default = field.get_db_prep_save(default, self.connection)
  File ".env/lib/python3.4/site-packages/django/db/models/fields/__init__.py", line 770, in get_db_prep_save
    prepared=False)
  File ".env/lib/python3.4/site-packages/django/db/models/fields/__init__.py", line 762, in get_db_prep_value
    value = self.get_prep_value(value)
  File ".env/lib/python3.4/site-packages/rdflib_django/fields.py", line 107, in get_prep_value
    return serialize_uri(value)
  File ".env/lib/python3.4/site-packages/rdflib_django/fields.py", line 82, in serialize_uri
    value, value.__class__)
ValueError: Cannot get prepvalue for None of type <class 'NoneType'>

Workaround suggestions welcome!

Still on management commands.

Hi, #devkral,
I was working on the management commands too. You've done it before. Thank you!
However, I'm not able to use your version without a few further patches. Please, tell me if I am wrong.

Without my patches to rdf_import, I'm getting the following errors:

python manage.py rdf_import rdf_import-200529.n3 --format n3
=> manage.py rdf_import: error: unrecognized arguments: rdf_import-200529.n3
python manage.py rdf_import --format n3 rdf_import-200529.n3
=> manage.py rdf_import: error: unrecognized arguments: rdf_import-200529.n3
python manage.py rdf_import --format n3 < rdf_import-200529.n3
=> CommandError: No file or resource specified.

Without my patches to rdf_export, I'm getting the following errors:

python manage.py rdf_export rdf_export-200529.n3 --format n3
=> manage.py rdf_export: error: unrecognized arguments: rdf_export-200529.n3
python manage.py rdf_export --format n3 rdf_export-200529.n3
=> manage.py rdf_export: error: unrecognized arguments: rdf_export-200529.n3
python manage.py rdf_export --format n3
>> Traceback (most recent call last):
...
  File "C:\commons321\lib\site-packages\rdflib\plugins\serializers\turtle.py", line 156, in write
    self.stream.write(text.encode(self.encoding, 'replace'))
TypeError: write() argument must be str, not bytes
python manage.py rdf_export --format n3 > rdf_export-200529.n3
>> Traceback (most recent call last):
...
  File "C:\commons321\lib\site-packages\rdflib\plugins\serializers\turtle.py", line 156, in write
    self.stream.write(text.encode(self.encoding, 'replace'))
TypeError: write() argument must be str, not bytes

With my corrections, I can do everything, except exporting through an os pipe; but I think that's another problem.

It seems that implementing (or emulating?) positional arguments for commands is very tricky in recent Django versions. In fact, I think that resorting to dash-style options would be more simple and clear (user friendly) also for i/o filepath arguments.
In any case, my version is in the fork at https://github.com/gtoffoli/rdflib-django3 .

NOTE: I'm developing with Python 3.5 and Django 2.1, on Windows 10; will put in production on Ubuntu.

Best, Giovanni

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.