SqlAlchemy Issues

All of the app functions have been written in sqlalchemy. They all work, in a limited fashion, but with a lot of effort.

mobiliitydb columns - there was a package that defined a limited set of mobilitydb columns, but Period was not one of them. I had to edit the package and add the Period datatype just so I could define the meow_dc table. (I need to finish the effort by writing test cases for the Period definition and finising the pull request.)

postgis functions - need to elaborately define all postgis functions (ST_AsText()) in extra 'func.' wrapper

geopandas - must read geom column (which must be named 'geom', btw) using pandas with func.STGeomFromWKB(), and then manually convert to a GeoDataFrame.

start/stop - sqlalchemy has issues with restarting when the (persistent) tables are already defined. Elaborate measures were taken to allow meow app to restart without errors.

class vs. tablename - have not figured out how to have one class (e.g. Sched) refer to multiple tables (sched_2020_06, sched_2020_07). Note that the Sched class only needs to refer to one of the actual tables at a time (don't need Sched to refer to mutliple tables at once), but do need to change the class reference from one table to the other. This issue has, for now, HALTED further use of sqlalchemy.

table definitions - must define all tables in their entirety (in case they need to be created), which makes source text verbose

References

How to map class to multiple tables (for sharding purpose) https://groups.google.com/forum/#!topic/sqlalchemy/1UbbDg8_t1s

requires bitbucket acct: https://bitbucket.org/zzzeek/sqlalchemy/wiki/UsageRecipes/EntityName

Horizontal Sharding https://docs.sqlalchemy.org/en/13/orm/extensions/horizontal_shard.html?highlight=horizontal#module-sqlalchemy.ext.horizontal_shard

Django-style Database Routers in SQLAlchemy https://techspot.zzzeek.org/2012/01/11/django-style-database-routers-in-sqlalchemy/

https://towardsdatascience.com/advanced-sqlalchemy-features-you-need-to-start-using-e6fc1ddafbdb

-- Mixins: https://github.com/absent1706/sqlalchemy-mixins

mobilitydb-sqlalchemy

Promised the author of the package that I would try to add Period.

official repo: https://github.com/adonmo/mobilitydb-sqlalchemy

my repo: https://github.com/wendellwt/mobilitydb-sqlalchemy

install poetry

from :https://python-poetry.org/docs/#installation

poetry on webfaction:

    cd ~/gis/mobilitydb-sqlqlchemy
    curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3.7

and that install says:

    Poetry (1.0.10) is installed now. Great!

    To get started you need Poetry's bin directory ($HOME/.poetry/bin) in your `PATH`
    environment variable. Next time you log in this will be done
    automatically.

    To configure your current shell run `source $HOME/.poetry/env`

ok.

    $ source $HOME/.poetry/env
    $ poetry --version
    Poetry version 1.0.10

ok, will try:

    $ git clone https://github.com/wendellwt/mobilitydb-sqlalchemy.git
    $ cd mobilitydb-sqlalchemy/
    $ poetry install
    Creating virtualenv mobilitydb-sqlalchemy-JDZ4RPsK-py3.7 in /home/wendell/.cache/pypoetry/virtualenvs
    <which install lots>

but then, the formatter doesn't install:

    $ pre-commit install
    -bash: pre-commit: command not found

docker on webfaction:

    $ wget https://download.docker.com/linux/static/stable/x86_64/docker-19.03.9.tgz
    $ tar zxvf docker-19.03.9.tgz

but then:

    $ docker/dockerd
    INFO[2020-08-15T20:23:22.572264114Z] Starting up
    dockerd needs to be started with root. To see how to run dockerd in rootless mode with unprivileged user, see the documentation

gave up.

NOPE, way too hard. Will just run the tests and hope for the best...

without dockere

    $ poetry run pytest
    E   ModuleNotFoundError: No module named 'fiona'

maybe I did this: $ pip3.7 install pymeos

it said fiona wasn't there (but it is!)

Gave up #2.