Skip to content

Commit

Permalink
Default if no columns
Browse files Browse the repository at this point in the history
  • Loading branch information
gabfl committed Oct 4, 2017
1 parent fbfc6ee commit 16e7b61
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export PYTHON_OVERRIDE=python3
make && make install
# Install bigquery_fdw
pip3 install bigquery_fdw
pip3 install bigquery-fdw
```

## Usage
Expand All @@ -56,8 +56,8 @@ With `psql`:
CREATE EXTENSION multicorn;

CREATE SERVER bigquery_srv FOREIGN DATA WRAPPER multicorn
OPTIONS (
wrapper 'bigquery_fdw.fdw.ConstantForeignDataWrapper'
OPTIONS (
wrapper 'bigquery_fdw.fdw.ConstantForeignDataWrapper'
);

CREATE FOREIGN TABLE my_bigquery_table (
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
long_description = open('README.md').read()

setup(
name='bigquery_fdw',
version='1.0',
name='bigquery-fdw',
version='1.0.2',
description='BigQuery Foreign Data Wrapper for PostgreSQL',
long_description=long_description,
author='Gabriel Bordeaux',
Expand Down
2 changes: 1 addition & 1 deletion src/bqclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def getQueryJob(self):
Returns `queryJob`
"""

return self.QueryJob
return self.queryJob

def readResult(self):
"""
Expand Down
19 changes: 11 additions & 8 deletions src/fdw.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,14 +196,17 @@ def buildSelectClause(self, columns):

# Add SELECT clause
clause += "SELECT "
for column in columns:
if column != self.partitionPseudoColumn: # Except for the partition pseudo column
clause += column + ", "
else:
clause += "null as " + column + ", " # Partition pseudo column is forced to return `null`

# Remove final `, `
clause = clause.strip(', ')
if columns: # If we have columns
for column in columns:
if column != self.partitionPseudoColumn: # Except for the partition pseudo column
clause += column + ", "
else:
clause += "null as " + column + ", " # Partition pseudo column is forced to return `null`

# Remove final `, `
clause = clause.strip(', ')
else: # Otherwide fetch all
clause += "*"

return clause

Expand Down

0 comments on commit 16e7b61

Please sign in to comment.