bmoscon / cryptostore

A scalable storage service for cryptocurrency data

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UndefinedTableError: relation "book" or "ticker" does not exist

aliabbas666 opened this issue · comments

I have run cryptostore on docker as well as directly on machie with backend postgres

run on docker with following command
sudo docker run -e EXCHANGE='COINBASE'
-e CHANNELS='trades,ticker,l2_book'
-e SYMBOLS='BTC-USD,ETH-USD'
-e BACKEND='POSTGRES'
-e DATABASE='postgres'
-e HOST='172.17.0.2'
-e PORT=5432
-e USER='postgres'
-e PASSWORD='mypassword'
ghcr.io/bmoscon/cryptostore:latest

run on machine directly
I exported following env variable
EXCHANGE='COINBASE'
CHANNELS='trades,ticker,l2_book'
SYMBOLS='BTC-USD,ETH-USD'
BACKEND='POSTGRES'
DATABASE='postgres'
HOST='127.0.0.1'
PORT=5432
USER='postgres'
PASSWORD='mypassword' \

i got following error . database connection is fine I have check it with application as well

future: exception=UndefinedTableError('relation "ticker" does not exist')>

Traceback (most recent call last):

File "/usr/local/lib/python3.9/site-packages/cryptofeed/backends/postgres.py", line 89, in writer

await self.write_batch(updates)

File "/usr/local/lib/python3.9/site-packages/cryptofeed/backends/postgres.py", line 105, in write_batch

await self.conn.execute(f"INSERT INTO {self.table} VALUES {args_str}")

File "/usr/local/lib/python3.9/site-packages/asyncpg/connection.py", line 318, in execute

return await self._protocol.query(query, timeout)

File "asyncpg/protocol/protocol.pyx", line 338, in query

asyncpg.exceptions.UndefinedTableError: relation "ticker" does not exist

Task exception was never retrieved

future: exception=UndefinedTableError('relation "trades" does not exist')>

Traceback (most recent call last):

File "/usr/local/lib/python3.9/site-packages/cryptofeed/backends/postgres.py", line 89, in writer

await self.write_batch(updates)

File "/usr/local/lib/python3.9/site-packages/cryptofeed/backends/postgres.py", line 105, in write_batch

await self.conn.execute(f"INSERT INTO {self.table} VALUES {args_str}")

File "/usr/local/lib/python3.9/site-packages/asyncpg/connection.py", line 318, in execute

return await self._protocol.query(query, timeout)

File "asyncpg/protocol/protocol.pyx", line 338, in query

asyncpg.exceptions.UndefinedTableError: relation "trades" does not exist

Task exception was never retrieved

future: exception=UndefinedTableError('relation "book" does not exist')>

Traceback (most recent call last):

File "/usr/local/lib/python3.9/site-packages/cryptofeed/backends/postgres.py", line 89, in writer

await self.write_batch(updates)

File "/usr/local/lib/python3.9/site-packages/cryptofeed/backends/postgres.py", line 105, in write_batch

await self.conn.execute(f"INSERT INTO {self.table} VALUES {args_str}")

File "/usr/local/lib/python3.9/site-packages/asyncpg/connection.py", line 318, in execute

return await self._protocol.query(query, timeout)

File "asyncpg/protocol/protocol.pyx", line 338, in query

asyncpg.exceptions.UndefinedTableError: relation "book" does not exist

^CTraceback (most recent call last):

File "/cryptostore.py", line 161, in

main()

File "/cryptostore.py", line 157, in main

fh.run()

File "/usr/local/lib/python3.9/site-packages/cryptofeed/feedhandler.py", line 157, in run

self.stop(loop=loop)

File "/usr/local/lib/python3.9/site-packages/cryptofeed/feedhandler.py", line 195, in stop

loop.run_until_complete(asyncio.gather(*shutdown_tasks))

File "uvloop/loop.pyx", line 1501, in uvloop.loop.Loop.run_until_complete

File "/usr/local/lib/python3.9/site-packages/cryptofeed/feed.py", line 271, in shutdown

await callback.stop()

File "/usr/local/lib/python3.9/site-packages/cryptofeed/backends/postgres.py", line 114, in stop

await self.write_batch(updates)

File "/usr/local/lib/python3.9/site-packages/cryptofeed/backends/postgres.py", line 105, in write_batch

await self.conn.execute(f"INSERT INTO {self.table} VALUES {args_str}")

File "/usr/local/lib/python3.9/site-packages/asyncpg/connection.py", line 318, in execute

return await self._protocol.query(query, timeout)

File "asyncpg/protocol/protocol.pyx", line 338, in query

asyncpg.exceptions.UndefinedTableError: relation "book" does not exist

you need to create the table definitions in your database

Thanks @bmoscon it is working