{"id":20008087,"url":"https://github.com/adonmo/mobilitydb-sqlalchemy","last_synced_at":"2025-05-04T19:34:26.081Z","repository":{"id":52602010,"uuid":"229757178","full_name":"adonmo/mobilitydb-sqlalchemy","owner":"adonmo","description":"MobilityDB extensions for SQLAlchemy","archived":false,"fork":false,"pushed_at":"2022-12-09T06:44:19.000Z","size":519,"stargazers_count":16,"open_issues_count":4,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-08T11:12:21.997Z","etag":null,"topics":["geospatial","gis","mobilitydb","orm","postgres","postgresql","sqlalchemy"],"latest_commit_sha":null,"homepage":"https://mobilitydb-sqlalchemy.readthedocs.io/en/latest/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adonmo.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-23T13:22:56.000Z","updated_at":"2023-04-24T22:57:51.000Z","dependencies_parsed_at":"2023-01-25T12:00:32.450Z","dependency_job_id":null,"html_url":"https://github.com/adonmo/mobilitydb-sqlalchemy","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adonmo%2Fmobilitydb-sqlalchemy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adonmo%2Fmobilitydb-sqlalchemy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adonmo%2Fmobilitydb-sqlalchemy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adonmo%2Fmobilitydb-sqlalchemy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adonmo","download_url":"https://codeload.github.com/adonmo/mobilitydb-sqlalchemy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252389897,"owners_count":21740225,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["geospatial","gis","mobilitydb","orm","postgres","postgresql","sqlalchemy"],"created_at":"2024-11-13T07:08:23.817Z","updated_at":"2025-05-04T19:34:25.707Z","avatar_url":"https://github.com/adonmo.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":".. image:: https://github.com/adonmo/mobilitydb-sqlalchemy/workflows/Tests/badge.svg\n   :target: https://github.com/adonmo/mobilitydb-sqlalchemy/actions\n   :alt: Test Status\n\n.. image:: https://readthedocs.org/projects/mobilitydb-sqlalchemy/badge/?version=latest\n   :target: https://mobilitydb-sqlalchemy.readthedocs.io/en/latest/?badge=latest\n   :alt: Documentation Status\n\n.. image:: https://pepy.tech/badge/mobilitydb-sqlalchemy\n   :target: https://pepy.tech/project/mobilitydb-sqlalchemy\n   :alt: PyPI downloads\n\n.. image:: https://img.shields.io/github/license/adonmo/mobilitydb-sqlalchemy.svg\n   :target: https://github.com/adonmo/mobilitydb-sqlalchemy/blob/master/LICENSE.txt\n   :alt: MIT License\n\nMobilityDB SQLAlchemy\n=====================\n\nThis package provides extensions to `SQLAlchemy \u003chttp://sqlalchemy.org/\u003e`_ for interacting with `MobilityDB \u003chttps://github.com/ULB-CoDE-WIT/MobilityDB\u003e`_. The data retrieved from the database is directly mapped to time-indexed pandas DataFrame objects. TGeomPoint and TGeogPoint objects can be optionally mapped to movingpandas' Trajectory data structure.\n\nThanks to the amazing work by `MobilityDB \u003chttps://github.com/ULB-CoDE-WIT/MobilityDB\u003e`_ and `movingpandas \u003chttps://github.com/anitagraser/movingpandas\u003e`_ teams, because of which this project exists.\n\nThis project is built using `PyMEOS \u003chttps://github.com/adonmo/meos\u003e`_\n\nA demo webapp built using this library is now available online:\n\n**Live Demo**: https://mobilitydb-sqlalchemy-demo.adonmo.com\n\n**Source Code**: https://github.com/adonmo/mobilitydb-sqlalchemy-demo\n\nInstallation\n============\n\nThe package is available on `PyPI \u003chttps://pypi.org/project/mobilitydb-sqlalchemy\u003e`_\\ , for Python \u003e= 3.7\n\n.. code-block:: sh\n\n    pip install mobilitydb-sqlalchemy\n\nUsage\n=====\n\n.. code-block:: py\n\n    from mobilitydb_sqlalchemy import TGeomPoint\n\n    from sqlalchemy import Column, Integer\n    from sqlalchemy.ext.declarative import declarative_base\n    Base = declarative_base()\n\n    class Trips(Base):\n        __tablename__ = \"test_table_trips_01\"\n        car_id = Column(Integer, primary_key=True)\n        trip_id = Column(Integer, primary_key=True)\n        trip = Column(TGeomPoint)\n\n    trips = session.query(Trips).all()\n\n    # Querying using MobilityDB functions, for example - valueAtTimestamp\n    session.query(\n        Trips.car_id,\n        func.ST_asText(\n            func.valueAtTimestamp(Trips.trip, datetime.datetime(2012, 1, 1, 8, 10, 0))\n        ),\n    ).all()\n\nThere is also a `tutorial \u003chttps://anitagraser.com/2020/03/02/movement-data-in-gis-29-power-your-web-apps-with-movement-data-using-mobilitydb-sqlalchemy/\u003e`_ published on Anita Graser's blog.\n\nFor more details, read our `documentation \u003chttps://mobilitydb-sqlalchemy.readthedocs.io/en/latest/\u003e`_ (specifically, the `quickstart \u003chttps://mobilitydb-sqlalchemy.readthedocs.io/en/latest/quickstart.html\u003e`_).\n\nContributing\n============\n\nIssues and pull requests are welcome.\n\n* For proposing new features/improvements or reporting bugs, `create an issue \u003chttps://github.com/adonmo/mobilitydb-sqlalchemy/issues/new/choose\u003e`_.\n* Check `open issues \u003chttps://github.com/adonmo/mobilitydb-sqlalchemy/issues\u003e`_ for viewing existing ideas, verify if it is already proposed/being worked upon.\n* When implementing new features make sure to add relavant tests and documentation before sending pull requests.\n\nSetup environment\n-----------------\n\nFirst, make sure you have `poetry installed \u003chttps://python-poetry.org/docs/#installation\u003e`_\nThen, get the dependencies by running (in the project home directory):\n\n.. code-block:: sh\n\n    poetry install\n\nAlso make sure you setup git hooks locally, this will ensure code is formatted using `black \u003chttps://github.com/psf/black\u003e`_ before committing any changes to the repository\n\n.. code-block:: sh\n\n    pre-commit install\n\nRunning Tests\n-------------\n\nSpin up a mobilitydb instance\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n.. code-block:: sh\n\n    docker volume create mobilitydb_data\n    docker run --name \"mobilitydb\" -d -p 25432:5432 -v mobilitydb_data:/var/lib/postgresql codewit/mobilitydb\n\nRun the tests\n^^^^^^^^^^^^^\n\nmovingpandas is an optional dependency - but to run tests you would need it. So if this is your first time running tests, install it by running:\n\n.. code-block:: sh\n\n    poetry install -E movingpandas\n\nNow, you can actually run the tests using:\n\n.. code-block:: sh\n\n    poetry run pytest\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadonmo%2Fmobilitydb-sqlalchemy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadonmo%2Fmobilitydb-sqlalchemy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadonmo%2Fmobilitydb-sqlalchemy/lists"}