Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[YSQL] Access YCQL tables via the YSQL API #830

Open
YourTechBud opened this issue Feb 3, 2019 · 10 comments
Open

[YSQL] Access YCQL tables via the YSQL API #830

YourTechBud opened this issue Feb 3, 2019 · 10 comments
Assignees
Labels
area/ysql Yugabyte SQL (YSQL) community/request Issues created by external users kind/enhancement This is an enhancement of an existing feature priority/medium Medium priority issue

Comments

@YourTechBud
Copy link

YourTechBud commented Feb 3, 2019

Jira Link: DB-699
Is it possible to access a cassandra table (created using cqlsh) via the postgres api?

@rkarthik007 rkarthik007 self-assigned this Feb 3, 2019
@rkarthik007 rkarthik007 added the kind/question This is a question label Feb 3, 2019
@rkarthik007
Copy link
Collaborator

Hi @noorainp,

It is not possible to access a YCQL (Cassandra) table directly using Postgres API. This is because the mapping of data types between the two APIs is not always possible (although the storage underneath is the same in the case of YugaByte DB and it would be possible to achieve). As examples:

  • YCQL supports collection types like map, list, set - these do not have PG equivalents
  • YCQL tables and rows can have a "TTL" based data expiry - SQL does not support this
  • There are various other constructs that do not map over such as static columns

However, it should be possible to import the YCQL table using FDW (foreign data wrappers) into Postgres as an external table and subsequently access it using PG. This approach has pro's and con's, but happy to support you in exploring this option if it is of interest to you.

One higher level question: what are you trying to achieve with the cross-access so that we can figure out the optimal solution together.

@YourTechBud
Copy link
Author

Hey. I totally understand that the datatypes of those two protocols are incompatible.

I was just hoping to get some postgres features like joins to Cassandra.

I know I can stick to Postgres entirely for such a trivial task, but the psql api lacks basic features like secondary indexes at this point.

@rkarthik007
Copy link
Collaborator

Ah got it! Support for secondary indexes and unique constraints is right around the corner - I would say a couple of weeks away. Does that work for you timeline wise?

@YourTechBud
Copy link
Author

That works! Awesome.

Would it be possible to index an existing table (containing data)? I read somewhere it isn't possible as of now. If not, when can we expect that feature?

Thanks once again buddy. I appreciate the warm welcome.

@rkarthik007
Copy link
Collaborator

Would it be possible to index an existing table (containing data)? I read somewhere it isn't possible as of now. If not, when can we expect that feature?

Yes, we are just starting to look at the design for this. Covered by #448 - but looks like you already found that 😄

Great questions btw @noorainp! And most welcome, look forward to working with you!

@YourTechBud
Copy link
Author

Thanks a ton.

@yugabyte-ci yugabyte-ci added the community/request Issues created by external users label Jul 17, 2019
@schoudhury schoudhury changed the title Access cassandra tables via the postgres api and vice versa Access YCQL tables via the YSQL API and vice versa Jan 21, 2020
@schoudhury schoudhury added kind/new-feature This is a request for a completely new feature and removed kind/question This is a question labels Jan 21, 2020
@schoudhury
Copy link
Contributor

Reopening issue for tracking purposes.

@diegov
Copy link

diegov commented Jul 6, 2020

There is a slightly different scenario from the OP's that I was hoping to evaluate if this feature became available, which is to have data whose canonical storage is behind the PostgreSQL API, but that is some times used in Spark jobs that would benefit from data locality features available through the Cassandra API. Read-only access would be good, r/w would be even better.

As an alternative, it would be good to have a built-in, optimised way to transfer data from one API to the other, with user-provided mapping functions if necessary.

@ymahajan
Copy link
Contributor

We have one additional request from community - The documentation depicts 2 API mechanisms to interact with Yugabytedb - YSQL and YCQL (faster API). Is there a single underlying storage format stored in DocDB which can be accessed by any or mix of the API? i.e can we have the OLTP txns use the YSQL APIs and during READ txns, can we use YCQL APIs for accessing the SAME database tables?

@m-iancu m-iancu changed the title Access YCQL tables via the YSQL API and vice versa [YSQL] Access YCQL tables via the YSQL API Sep 13, 2021
@m-iancu m-iancu assigned fizaaluthra and unassigned rkarthik007 Mar 7, 2022
@Tasneem9879 Tasneem9879 added the area/ysql Yugabyte SQL (YSQL) label Jun 7, 2022
@yugabyte-ci yugabyte-ci added priority/medium Medium priority issue kind/bug This issue is a bug priority/high High Priority and removed kind/new-feature This is a request for a completely new feature priority/medium Medium priority issue labels Jun 7, 2022
@yugabyte-ci yugabyte-ci added kind/new-feature This is a request for a completely new feature and removed kind/bug This issue is a bug labels Jul 8, 2022
@yugabyte-ci yugabyte-ci added kind/enhancement This is an enhancement of an existing feature and removed kind/new-feature This is a request for a completely new feature labels Aug 18, 2022
@yugabyte-ci yugabyte-ci added priority/medium Medium priority issue and removed priority/high High Priority labels Oct 12, 2022
@lefay1982
Copy link

lefay1982 commented Apr 11, 2024

Hi @noorainp,

It is not possible to access a YCQL (Cassandra) table directly using Postgres API. This is because the mapping of data types between the two APIs is not always possible (although the storage underneath is the same in the case of YugaByte DB and it would be possible to achieve). As examples:

  • YCQL supports collection types like map, list, set - these do not have PG equivalents
  • YCQL tables and rows can have a "TTL" based data expiry - SQL does not support this
  • There are various other constructs that do not map over such as static columns

However, it should be possible to import the YCQL table using FDW (foreign data wrappers) into Postgres as an external table and subsequently access it using PG. This approach has pro's and con's, but happy to support you in exploring this option if it is of interest to you.

One higher level question: what are you trying to achieve with the cross-access so that we can figure out the optimal solution together.

I have the same request: OLTP use YCQL for performance and OLAP use YSQL to support join tables to query data.

  • map, list, set - can use PG json datatype equivalent
  • TTL not use
  • static columns not use

If YSQL can Access the YCQL table, my request can achieve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ysql Yugabyte SQL (YSQL) community/request Issues created by external users kind/enhancement This is an enhancement of an existing feature priority/medium Medium priority issue
Projects
None yet
Development

No branches or pull requests

9 participants