Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions cli/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,27 +214,27 @@ describe('cli run', () => {
})

it('runs a named query from a markdown file', async () => {
let res = await runCli(['run', 'index.md', '--query', 'performance_by_year'], {cwd: flightDir})
let res = await runCli(['run', 'pages/operations_overview.md', '--query', 'performance_by_year'], {cwd: flightDir})
expectCliSuccess(res, 'run markdown query')
expect(res.stdout.toLowerCase()).toContain('flight_count')
})

it('prints csv for a named query from a markdown file with --format csv', async () => {
let res = await runCli(['run', 'index.md', '--query', 'performance_by_year', '--format', 'csv'], {cwd: flightDir})
let res = await runCli(['run', 'pages/operations_overview.md', '--query', 'performance_by_year', '--format', 'csv'], {cwd: flightDir})
expectCliSuccess(res, 'run markdown query as csv')
expect(res.stdout.startsWith('year,status,flight_count\n')).toBe(true)
expect(res.stdout).not.toContain('┌')
})

it('runs a parameterized named query from a markdown file with --input', async () => {
let res = await runCli(['run', 'carrier_detail.md', '--query', 'carrier_info', '--input', 'carrier=AA'], {cwd: flightDir})
let res = await runCli(['run', 'pages/carrier_detail.md', '--query', 'carrier_info', '--input', 'carrier=AA'], {cwd: flightDir})
expectCliSuccess(res, 'run parameterized markdown query')
expect(res.stdout).toContain('AA')
})

it('runs a markdown page in headless mode', async () => {
try {
let res = await runCli(['run', 'index.md', '--headless', '--chart', 'Flight Status by Year'], {cwd: flightDir, env: {NODE_ENV: 'development'}})
let res = await runCli(['run', 'pages/operations_overview.md', '--headless', '--chart', 'Flight Status by Year'], {cwd: flightDir, env: {NODE_ENV: 'development'}})
expectCliSuccess(res, 'run markdown page headless')
expect(res.stdout).toContain('No errors found')
expect(res.stdout).toContain('Screenshot saved to')
Expand All @@ -244,7 +244,7 @@ describe('cli run', () => {
})

it('prints a clean error for a missing markdown query input', async () => {
let res = await runCli(['run', 'carrier_detail.md', '--query', 'carrier_info'], {cwd: flightDir})
let res = await runCli(['run', 'pages/carrier_detail.md', '--query', 'carrier_info'], {cwd: flightDir})
expect(res.code).toBe(1)
expect(res.stderr.trim()).toBe('Missing param $carrier')
})
Expand Down
4 changes: 2 additions & 2 deletions cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ program
let datasets = await connection.listDatasets()
let matchedDataset = tableArg ? findCaseInsensitive(datasets, tableArg) : null

// if there's no arg and more than one dataset, just list the datasets
if (!tableArg && datasets.length > 1) {
// If there's no configured namespace and more than one dataset, list the datasets.
if (!tableArg && !config.defaultNamespace && datasets.length > 1) {
return console.log(`Datasets available:\n${datasets.join('\n')}`)
}

Expand Down
2 changes: 1 addition & 1 deletion cli/schema.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ describe.skipIf(!process.env.SLOW_TEST)('bigquery', () => {
let res = await runCli(['schema', tableName], ecommDir)
expectCliSuccess(res, 'schema describe table (bigquery)')
let output = res.stdout.toLowerCase()
expect(output).toContain('tables in demo_dataset:')
expect(output).toContain(`table ${tableName.toLowerCase()} (`)
})
})

Expand Down
29 changes: 12 additions & 17 deletions examples/flights/AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
# RULES
## About the data

- Graphene contains languages and tools that you do not already know.
- Before writing code in this directory, you MUST read `@../../docs/base.md` **in its entirety**.
- You MUST also read relevant reference docs in `@../../docs/references/*.md` before implementing or editing related functionality.
- Treat reference docs as required context, not optional reading.
- If a task touches multiple areas (for example: GSQL + chart components), read all applicable reference files first.
- If unsure which reference applies, start with `@../../docs/references/gsql.md`, then load additional references based on the components/functions used.
- You will be docked for writing code here without completing the required documentation reading.
- This is an example Graphene project to analyze FAA flight data from 2000-2005.
- All available data is in `./tables`

## Reference docs
## Instructions

- Core overview: `@../../docs/base.md`
- CLI usage: `@../../docs/cli.md`
- Best practices: `@../../docs/best-practices.md`
- Detailed feature/component references: `@../../docs/references/*.md`

# About this data

This is a Graphene project covering FAA flight data from 2000 to 2005. You can find the Graphene tables in @./tables.
- ALWAYS read the following before using the graphene CLI or editing .gsql or .md:
- Core overview: `@../../docs/base.md`
- CLI usage: `@../../docs/cli.md`
- Best practices: `@../../docs/best-practices.md`
- Additional reference documentation is available in the `@../../docs/references` folder.
- Assume all DuckDB functions are available when writing GSQL.
- This example project uses pnpm, so run the Graphene CLI using `pnpm graphene ...`.
- If you have an in-app browser tool, use it to show the user any changes you make to a Graphene page.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading