GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - MobilityDB/MobilityDB-python: Python driver for MobilityDB

This repository was archived by the owner on May 1, 2026. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

198 Commits
198 Commits

Folders and files

NameName
Last commit message
Last commit date
.idea
.idea
 
 
doc
doc
 
 
mobilitydb
mobilitydb
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
.travis.yml
.travis.yml
 
 
README.md
README.md
 
 
setup.cfg
setup.cfg
 
 
setup.py
setup.py
 
 

Repository files navigation

MobilityDB-python — DEPRECATED

⚠️ This repository is archived and no longer maintained.

Use PyMEOS instead.

PyMEOS is the actively maintained Python binding for the MEOS C library underneath MobilityDB. It supersedes this driver — it covers the same psycopg2-based PostgreSQL workflow (via pymeos.db.psycopg2.MobilityDB) and additionally provides the full MEOS API in idiomatic Python, suitable for use with MobilityDB, MobilityDuck, or standalone MEOS.

This repository is preserved in archived form for historical reference and to keep existing links / citations resolvable. The deprecation notice has been in place since 2023.


MobilityDB-python

MobilityDB-python is a database adapter to access MobilityDB from Python. It supports both the psycopg2 and the asyncpg adapters for PostgreSQL and uses the postgis adapter for PostGIS.

Deprecation Notice ⚠️

This package is no longer up-to-date with the recent and incoming changes of MobilityDB, and will no longer by maintained.
We recommend using the PyMEOS package, which provides a Python interface to the MEOS C library, the underlying library of MobilityDB.

Install

pip install python-mobilitydb

Requirements

  • Python >= 3.0
  • MobilityDB

Basic Usage

Using the psycopg2 adapter for PostgreSQL

import psycopg2
from mobilitydb.psycopg import register

connection = None

try:
    # Set the connection parameters to PostgreSQL
    connection = psycopg2.connect(host='localhost', database='test', user='user', password='pw')
    connection.autocommit = True

    # Register MobilityDB data types
    register(connection)

    # Open a cursor to perform database operations
    cursor = connection.cursor()

    # Query the database and obtain data as Python objects
    select_query = "SELECT * FROM tbl_tfloatseq ORDER BY k LIMIT 10"
    cursor.execute(select_query)
    rows = cursor.fetchall()

    # Print the obtained rows and call a method on the instances
    for row in rows:
        print("key =", row[0])
        print("tfloatseq =", row[1])
        if not row[1]:
            print("")
        else:
            print("startTimestamp =", row[1].startTimestamp.isoformat(), "\n")

except (Exception, psycopg2.Error) as error:
    print("Error while connecting to PostgreSQL", error)

finally:
    # Close the connection
    if connection:
        connection.close()

Using the asyncg adapter for PostgreSQL

import asyncio
import asyncpg
from mobilitydb.asyncpg import register


async def run():
    # Connect to an existing database
    connection = await asyncpg.connect(host='localhost', database='test', user='user', password='pw')

    try:
        # Register MobilityDB data types
        await register(connection)

        # Query the database and obtain data as Python objects
        select_query = "SELECT * FROM tbl_tgeompointseq ORDER BY k LIMIT 10"
        rows = await connection.fetch(select_query)

        # Print the obtained rows and call a method on the instances
        for row in rows:
            print("key =", row[0])
            print("tgeompointseq =", row[1])
            if not row[1]:
                print("")
            else:
                print("startTimestamp =", row[1].startTimestamp.isoformat(), "\n")
    finally:
        # Close the connection
        await connection.close()

# Launch the process
loop = asyncio.get_event_loop()
loop.run_until_complete(run())

Manual

HTML: https://docs.mobilitydb.com/MobilityDB-python/master/

PDF: https://docs.mobilitydb.com/MobilityDB-python/master/python-mobilitydb.pdf

EPUB: https://docs.mobilitydb.com/MobilityDB-python/master/python-mobilitydb.epub

Contributing

Issues and Pull Requests are welcome.

Related Project

MobilityDB SQLAlchemy is another package that provides extensions to SQLAlchemy for interacting with MobilityDB.

About

Python driver for MobilityDB

Resources

Readme
Activity
Custom properties

Stars

12 stars

Watchers

3 watching

Forks

7 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.