Rethinkdb: How to create a copy/clone of a table? Or How to save query result as a Table?

Created on 14 Mar 2013  路  5Comments  路  Source: rethinkdb/rethinkdb

Whenever i want to manipulate a table, i would like to create a copy of that table and then manipulate on copy.

How to do this in Rethinkdb using Javascript?

Most helpful comment

You could do this:

r.db('foo').tableCreate('bar').run(...)
r.db('foo').table('bar').insert(r.db('foo').table('baz')).run(...)

This will insert the contents of table baz into table bar. You can pass queries to insert, and it will insert the rows into the table. Let me know if this makes sense.

All 5 comments

You could do this:

r.db('foo').tableCreate('bar').run(...)
r.db('foo').table('bar').insert(r.db('foo').table('baz')).run(...)

This will insert the contents of table baz into table bar. You can pass queries to insert, and it will insert the rows into the table. Let me know if this makes sense.

@ekanna if you don't mind me suggesting, I think posting these questions on StackOverflow and tagging them with rethinkdb would benefit more people than opening them as issues on Github. We'll answer them but on StackOverflow there will be more people that will be able to find them, while here once closed they'll be lost with other hundreds and hundreds of other code related issues we are continuously closing.

Actually, we'd really appreciate if you could migrate to StackOverflow the last couple of questions you've asked so we preserve them for other users. Thanks a lot

@ekanna we're very happy to answer your questions but @al3xandru is right. This isn't the ideal formum for "how do I do this" questions. Anything posted as a github issue should be an issue to which the fix is code being committed to the repo.

I'd also just like to make it clear in this issue that copying from one table to another will be a slow operation proportional to the size of the table. There's no copy on write type optimizations happening in the background.

Thanks guys for educating me on this. This is lack of awareness on my side where to post and what. Sorry for the trouble. In fact, i checked your wiki home page for this project to know where to post and what. But there is nothing mentioned in your wiki home page. And i did not further check on your site home page where you have mentioned google groups.

May be you can update your wiki home page also, some thing like below, so that new comers like me won't commit this type of mistakes again.

For discussions: googlegroups/rethinkdb
For Q & A : stackoverflow with tag rethinkdb
For Issues : github/rethinkdb/issues
and whatever other channels you have..

sorry for the trouble once again.

@coffeemug thanks. It is working fine.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sain801028 picture sain801028  路  4Comments

RaitoBezarius picture RaitoBezarius  路  4Comments

xbaker picture xbaker  路  5Comments

analytik picture analytik  路  5Comments

jlhawn picture jlhawn  路  4Comments