TonicAI / condenser

Condenser is a database subsetting tool
https://www.tonic.ai
MIT License
312 stars 48 forks source link

Doesn't seem to work on ubuntu #36

Closed SarahClerge closed 1 year ago

SarahClerge commented 1 year ago

Hi,

To write a blog post for my company, I wanted to run Conderser on Ubuntu.

I downloaded Pynthon 3 (updated), python3-mysql.connector, python-psycopg2 and python-toposort, then I copied the repo on my machine, after installing postgresql 14 and putting a database that would serve as a test game.

Of course, I made sure that my environment variables included the variables from the Postgresql libraries.

I created my own configuration file, named config.json, here is what it contains:

{
"initial_targets": [
        {
            "table": "mgd.gxd_htsample_rnaseq",
            "percent": 10
        }
    ],
    "db_type": "postgres",
    "source_db_connection_info": {
        "user_name": "postgres",
        "host": "localhost",
        "db_name": "test",
        "port": 5432
    },
    "destination_db_connection_info": {
        "user_name": "postgres",
        "host": "localhost",
        "db_name": "test2",
        "port": 5432
    },
    "keep_disconnected_tables": false,
    "excluded_tables": [ ],
    "passthrough_tables": [ ],
    "dependency_breaks": [ ],
    "fk_augmentation": [ ],
    "upstream_filters": [ ]
 }

Thinking I had everything configured correctly, I therefore launched the python script direct_subset.py.

And I ended up with the following error:

Traceback (most recent call last):
  File "direct_subset.py", line 2, in <module>
    import config_reader, result_tabulator
  File "/var/lib/postgresql/condenser/config_reader.py", line 8
    print('WARNING: Attempted to initialize configuration twice.', file=sys.stderr)
                                                                       ^
SyntaxError: invalid syntax

Trying to understand where this error comes from, I deleted the two files config.json.example and config.json.example_all, but I still have the same error.

And since I've never done python, I'm unable to debug myself...

Could someone tell me what's wrong?

Thanks !

mwcaisse commented 1 year ago

Hi Sarah,

Would you mind sharing the full command that you are using to run?

Is it python script direct_subset.py? If so, I would make sure that python refers to python3, I believe on older versions of Ubuntu python is the python 2 executable, while python3 points to python 3. Condenser only supports python3.