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

[JSTC-37] Create table help output shows prefix #87

Closed
sanderpick opened this issue Jul 11, 2023 · 10 comments
Closed

[JSTC-37] Create table help output shows prefix #87

sanderpick opened this issue Jul 11, 2023 · 10 comments
Labels
bug Something isn't working linear Sync issue with linear Medium priority Created by Linear-GitHub Sync

Comments

@sanderpick
Copy link
Member

When creating a table, I noticed that the prefix is auto-applied from the table name in the create statement (neat!). However, the help command still shows that you can supply a prefix. I'm not sure if that still actually works. In either case, I don't think there should be two ways to do this… or if that is needed for some reason, the help command should be clear about it.

tableland create [schema] [prefix]        Create a new table

cc @carsonfarmer @joewagner

From SyncLinear.com | JSTC-37

@sanderpick sanderpick added bug Something isn't working Medium priority Created by Linear-GitHub Sync labels Jul 11, 2023
@joewagner
Copy link
Contributor

@sanderpick good call on this command being unclear. I'm dumping my thoughts below...

For context, I believe we have 5 ways to run the create command:

  1. provide a schema and prefix via command args
  2. provide a schema via command args. (note: table name will not have a prefix, e.g. _31337_3. This feature was added by a request that may have originated in discord. Details: [JSTC-27] Don't require prefix flag for create command with schema js-tableland-cli#306)
  3. provide a full create query. (note: this can be any number of create statements, i.e. you can create all your tables with one command)
  4. call the command with no arguments, which opens a stdin prompt allowing you to freely type. (note: I just tried this out and I'm not sure this works right. If we want to keep this feature I can open an issue to fix)
  5. use the command to run a file that contains SQL.

The full text of npx tableland create --help tries to explain to explain all of this, but maybe still confusing.

Ideas:

  • Reduce the number of ways to use create.
  • Replace the current usage with a different single usage.
  • Make changes to the help messages.
  • other?
    cc: @dtbuchholz @awmuncy

@carsonfarmer
Copy link
Member

I think input from stdin/files is still useful. We should just drop support for extra flags etc though (IMO). Because there should really just be one way to do it, using a create statement. Stdin/files are also just doing it the same way (via a create statement), they are just alternative input sources.

@carsonfarmer
Copy link
Member

I think the stdin option requires you to pipe in the content? But not 100% sure anymore?

@joewagner
Copy link
Contributor

I think the stdin option requires you to pipe in the content? But not 100% sure anymore?

That makes sense. You can just type, but the prompt never closes and only works for the first statement.

@carsonfarmer
Copy link
Member

Does Ctrl+D properly close it out?

@joewagner
Copy link
Contributor

Does Ctrl+D properly close it out?

Yeah, which is all good, it's just a little confusing since the second (and third etc) command don't do anything.

@joewagner
Copy link
Contributor

I think input from stdin/files is still useful. We should just drop support for extra flags etc though (IMO). Because there should really just be one way to do it, using a create statement. Stdin/files are also just doing it the same way (via a create statement), they are just alternative input sources.

Sounds good to me, but this would undo the changes that fixed tablelandnetwork/js-tableland-cli#306 so maybe @dtbuchholz has thoughts.

@dtbuchholz
Copy link
Contributor

I think that should be fine...I should be able to pass an empty prefix within a full create statement anyways like create table "" ...

@sanderpick
Copy link
Member Author

Ah, makes sense! I didn't even realize that i had supplied a full create statement. That is a nice pattern. The other way that makes sense to me is with the shell command => just type SQL as normal, including create statements. That's possible, right?

I don't have a strong pref on removing options here... but we should document them. If I do tableland create --help I just see:

tableland create -h
tableland create [schema] [prefix]

Create a new table

Positionals:
  schema  SQL table schema, or full create statement (skip to read from stdin)
                                                                        [string]

Options:
  -h, --help                 Show help                                 [boolean]
  -V, --version              Show version number                       [boolean]
      --baseUrl              The URL of your Tableland validator        [string]
  -c, --chain                The EVM chain to target                    [string]
      --enableEnsExperiment  Enable ENS experiment                     [boolean]
      --ensProviderUrl       Enable ENS experiment                      [string]
  -k, --privateKey           Private key string                         [string]
  -p, --providerUrl          JSON RPC API provider URL. (e.g., https://eth-rinke
                             by.alchemyapi.io/v2/123abc123a...)         [string]
      --prefix               Table name prefix (ignored if full create statement
                              is provided)                              [string]
      --ns                   ENS namespace to resolve schema from (experimental)
                                                                        [string]
  -f, --file                 Get statement from input file

I think some examples of the different patterns would be nice in the help output.

@dtbuchholz dtbuchholz transferred this issue from tablelandnetwork/js-tableland-cli Nov 21, 2023
@dtbuchholz dtbuchholz added the linear Sync issue with linear label Nov 21, 2023
@dtbuchholz
Copy link
Contributor

(moved to new issue #90)

@dtbuchholz dtbuchholz closed this as not planned Won't fix, can't repro, duplicate, stale Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working linear Sync issue with linear Medium priority Created by Linear-GitHub Sync
Projects
None yet
Development

No branches or pull requests

4 participants