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

drop temporary CT tables #28

Closed
2 tasks done
oschulte opened this issue Jun 17, 2017 · 13 comments
Closed
2 tasks done

drop temporary CT tables #28

oschulte opened this issue Jun 17, 2017 · 13 comments
Assignees
Labels

Comments

@oschulte
Copy link
Collaborator

oschulte commented Jun 17, 2017

could use a general drop procedure

  • this would save a lot of space
  • also make the output easier to read
@oschulte
Copy link
Collaborator Author

Hi Zhao @JanyQZ you're right I'm missing details. Not sure what happened. Here's the kind of procedure we need.

KeepTablesOnly(connection,dbname,list of tablenames)
Inputs:

  • connection object connection
  • name of database schema dbname
  • list of tablenames

Output: all tables in dbname are dropped except for the tables listed tablenames

Example:

  • dbname = unielwin_ct
  • tablesname = a_ct

The only table left in unielwin_ct should be a_ct

@oschulte
Copy link
Collaborator Author

@JanyQZ Hi Jany, were you able to solve this problem? Can you please confirm that you are set up to get these messages from github?

@JanyQZ
Copy link
Contributor

JanyQZ commented Jul 6, 2017

@oschulte Hi, Oliver, I am now working at drop_tmpTable branch. And I added a new class which named KeepTablesOnly.java. The mainly function looks like Drop_tmpTables(Connection con,String dbname,String tablename). The function is currently available to keep only one table given by the input.
What I am thinking is that we can add a new variable to indicate the number of reserved tables and change tablename into a array, which may looks like Drop_tmpTables(Connection con,String dbname,String[] tablesname). We can talk about this issue later :)

@oschulte
Copy link
Collaborator Author

oschulte commented Jul 7, 2017

@JanyQZ sounds good! I agree with having an array of tables.

@JanyQZ
Copy link
Contributor

JanyQZ commented Jul 15, 2017

@oschulte Hi Oliver, I found that we couldn't drop the table with a comma name, such as "a,b_counts", cause mysql automatically splits the sql query based on commas assuming they are separate tables and returns an error message which like "Unknown table x,xxx". I think we really need to standardize the tables names and not using commas.

@oschulte
Copy link
Collaborator Author

oschulte commented Jul 17, 2017

Hi Jany, changing table names is not a bad idea but a fair amount of work. Have you tried escaping the table name with apostrophes? E.g.

drop table a,b_counts
not
drop table a,b_counts
?

@oschulte oschulte mentioned this issue Jul 17, 2017
12 tasks
@JanyQZ
Copy link
Contributor

JanyQZ commented Jul 17, 2017

@oschulte Hi, Oliver, I've already tried both of the command, it didn't work.
Actually, it's very strange to add a comma into a table name. We should not do that at the very beginning.

@oschulte
Copy link
Collaborator Author

let's discuss with Vidhi

@JanyQZ
Copy link
Contributor

JanyQZ commented Jul 18, 2017

@oschulte HI, Oliver, I found a way to solve this problem. We can wrap the table name with the symbol ``, such as a,b_counts, it will indicate entire string is one table name. I will fix this function as soon as possible and merge into the project.

@oschulte
Copy link
Collaborator Author

okay great. Can we drop tables now?

@JanyQZ
Copy link
Contributor

JanyQZ commented Jul 20, 2017

Of course we can! Also you can see all the commit changes in pull request. It works well.

@oschulte
Copy link
Collaborator Author

Let's review this and see if we need to add some documentation

@oschulte oschulte self-assigned this Jul 26, 2017
@oschulte
Copy link
Collaborator Author

Jany posted the drop table code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants