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

feat: Support snapshot queries #215

Merged
merged 11 commits into from
Sep 18, 2024
Merged

feat: Support snapshot queries #215

merged 11 commits into from
Sep 18, 2024

Conversation

taka-oyama
Copy link
Collaborator

@taka-oyama taka-oyama commented Jun 3, 2024

Fix: #145

Checklist

  • CHANGELOG

Reference

Summary by CodeRabbit

  • New Features
    • Introduced support for snapshot queries, allowing users to retrieve historical data.
    • Added methods for managing and checking snapshot usage within queries.
  • Improvements
    • Enhanced query execution performance by automatically wrapping values in UNNEST for large datasets.
    • Improved transaction handling to ensure read-write operations are executed appropriately based on context.

@taka-oyama taka-oyama added the enhancement New feature or request label Jun 3, 2024
@taka-oyama taka-oyama self-assigned this Jun 3, 2024
@taka-oyama
Copy link
Collaborator Author

@coderabbitai review

Copy link

coderabbitai bot commented Jun 11, 2024

Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

coderabbitai bot commented Jun 11, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

The changes introduce enhanced querying capabilities with the addition of snapshot queries, allowing users to retrieve data as it existed at a specific point in time. The Connection class is modified to manage snapshot states, and new methods are added to facilitate this functionality. The Query\Builder class is also updated to support more flexible querying options, including modifications to existing methods.

Changes

File Path Change Summary
CHANGELOG.md Updated to reflect new features: snapshot queries, enhancements to whereNotInUnnest(...), and modifications to whereIn.
src/Connection.php Added snapshot management functionality, including new methods for executing snapshot queries and checking transaction types.
src/Query/Builder.php Added whereNotInUnnest(...) method and modified whereIn method for improved querying options.

Assessment against linked issues

Objective (Issue #) Addressed Explanation
Implement snapshot read-only transactions (#145)

Possibly related PRs

  • feat: Support snapshot queries #215: This PR adds support for snapshot queries, which is a key feature in the main PR, indicating a direct connection in functionality.
  • feat: add support for whereNotInUnnest #225: This PR introduces the whereNotInUnnest(...) method in the Query\Builder class, which is also a significant enhancement mentioned in the main PR, linking both changes at the code level.

Suggested reviewers

  • halnique

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    -- I pushed a fix in commit <commit_id>, please review it.
    -- Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    -- @coderabbitai generate unit testing code for this file.
    -- @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    -- @coderabbitai generate interesting stats about this repository and render them as a table.
    -- @coderabbitai read src/utils.ts and generate unit testing code.
    -- @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    -- @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between fbed84c and 49d9f30.

Files selected for processing (3)
  • src/Connection.php (1 hunks)
  • src/Query/Builder.php (2 hunks)
  • src/Query/Concerns/UsesSnapshot.php (1 hunks)
Additional context used
PHPStan
src/Query/Builder.php

null-null: Ignored error pattern #^Strict comparison using === between Illuminate\Database\Query\IndexHint and null will always evaluate to false.$# in path /cache/1a5483e6-0399-4ade-9400-837a7d9808e5/home/jailuser/git/src/Query/Builder.php was not matched in reported errors. (ignore.unmatched)


26-26: Class Colopl\Spanner\Query\Builder extends unknown class Illuminate\Database\Query\Builder. (class.notFound)
Learn more at https://phpstan.org/user-guide/discovering-symbols


43-43: Method Colopl\Spanner\Query\Builder::insert() has no return type specified. (missingType.return)


45-45: Colopl\Spanner\Query\Builder::insert() calls parent::insert() but Colopl\Spanner\Query\Builder does not extend any class. (class.noParent)


51-51: Method Colopl\Spanner\Query\Builder::update() has no return type specified. (missingType.return)


59-59: Colopl\Spanner\Query\Builder::update() calls parent::update() but Colopl\Spanner\Query\Builder does not extend any class. (class.noParent)


65-65: Method Colopl\Spanner\Query\Builder::updateOrInsert() has no return type specified. (missingType.return)


67-67: Call to an undefined method Colopl\Spanner\Query\Builder::where(). (method.notFound)


71-71: Call to an undefined method Colopl\Spanner\Query\Builder::take(). (method.notFound)


71-71: Call to static method except() on an unknown class Illuminate\Support\Arr. (class.notFound)
Learn more at https://phpstan.org/user-guide/discovering-symbols


77-77: Method Colopl\Spanner\Query\Builder::upsert() has no return type specified. (missingType.return)


77-77: Method Colopl\Spanner\Query\Builder::upsert() has parameter $uniqueBy with no type specified. (missingType.parameter)


77-77: Method Colopl\Spanner\Query\Builder::upsert() has parameter $update with no type specified. (missingType.parameter)


93-93: Call to an undefined method Colopl\Spanner\Query\Builder::applyBeforeQueryCallbacks(). (method.notFound)


96-96: Access to an undefined property Colopl\Spanner\Query\Builder::$grammar. (property.notFound)
Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property


97-97: Call to an undefined method Colopl\Spanner\Query\Builder::cleanBindings(). (method.notFound)


97-97: Call to static method flatten() on an unknown class Illuminate\Support\Arr. (class.notFound)
Learn more at https://phpstan.org/user-guide/discovering-symbols


104-104: Method Colopl\Spanner\Query\Builder::truncate() has no return type specified. (missingType.return)


106-106: Call to an undefined method Colopl\Spanner\Query\Builder::applyBeforeQueryCallbacks(). (method.notFound)


108-108: Access to an undefined property Colopl\Spanner\Query\Builder::$grammar. (property.notFound)
Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property


131-131: Access to an undefined property Colopl\Spanner\Query\Builder::$wheres. (property.notFound)
Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property


133-133: Call to an undefined method Colopl\Spanner\Query\Builder::addBinding(). (method.notFound)


144-144: Parameter $values of method Colopl\Spanner\Query\Builder::whereInUnnest() has invalid type Illuminate\Contracts\Support\Arrayable. (class.notFound)


151-151: Access to an undefined property Colopl\Spanner\Query\Builder::$wheres. (property.notFound)
Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property


153-153: Call to an undefined method Colopl\Spanner\Query\Builder::addBinding(). (method.notFound)


168-168: Call to static method isAssoc() on an unknown class Illuminate\Support\Arr. (class.notFound)
Learn more at https://phpstan.org/user-guide/discovering-symbols


178-178: Method Colopl\Spanner\Query\Builder::runSelect() has no return type specified. (missingType.return)


180-180: Call to an undefined method Colopl\Spanner\Query\Builder::toSql(). (method.notFound)


181-181: Call to an undefined method Colopl\Spanner\Query\Builder::getBindings(). (method.notFound)


210-210: Access to an undefined property Colopl\Spanner\Query\Builder::$indexHint. (property.notFound)
Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property


210-210: Class Colopl\Spanner\Query\IndexHint does not have a constructor and must be instantiated without any parameters. (new.noConstructor)


220-220: Access to an undefined property Colopl\Spanner\Query\Builder::$indexHint. (property.notFound)
Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property

src/Connection.php

null-null: Ignored error pattern #^Cannot access offset 'requestTag' on mixed.$# in path /cache/1a5483e6-0399-4ade-9400-837a7d9808e5/home/jailuser/git/src/Connection.php was not matched in reported errors. (ignore.unmatched)


null-null: Ignored error pattern #^Expression on left side of ?? is not nullable.$# in path /cache/1a5483e6-0399-4ade-9400-837a7d9808e5/home/jailuser/git/src/Connection.php was not matched in reported errors. (ignore.unmatched)


null-null: Ignored error pattern #^Generator expects value type array, mixed given.$# in path /cache/1a5483e6-0399-4ade-9400-837a7d9808e5/home/jailuser/git/src/Connection.php was not matched in reported errors. (ignore.unmatched)


null-null: Ignored error pattern #^Method Colopl\Spanner\Connection::selectWithOptions() should return array<int, array> but returns mixed.$# in path /cache/1a5483e6-0399-4ade-9400-837a7d9808e5/home/jailuser/git/src/Connection.php was not matched in reported errors. (ignore.unmatched)


null-null: Ignored error pattern #^Parameter #1 $pdo of method Illuminate\Database\Connection::__construct() expects Closure|PDO, null given.$# in path /cache/1a5483e6-0399-4ade-9400-837a7d9808e5/home/jailuser/git/src/Connection.php was not matched in reported errors. (ignore.unmatched)


null-null: Ignored error pattern #^Parameter #1 $start of method Illuminate\Database\Connection::getElapsedTime() expects int, float given.$# in path /cache/1a5483e6-0399-4ade-9400-837a7d9808e5/home/jailuser/git/src/Connection.php was not matched in reported errors. (ignore.unmatched)


null-null: Ignored error pattern #^Parameter #1 $table of method Illuminate\Database\Query\Builder::from() expects Closure|Illuminate\Database\Eloquent\Builder|Illuminate\Database\Query\Builder|string, Closure|Illuminate\Contracts\Database\Query\Expression|Illuminate\Database\Query\Builder|string given.$# in path /cache/1a5483e6-0399-4ade-9400-837a7d9808e5/home/jailuser/git/src/Connection.php was not matched in reported errors. (ignore.unmatched)


49-49: Class Colopl\Spanner\Connection extends unknown class Illuminate\Database\Connection. (class.notFound)
Learn more at https://phpstan.org/user-guide/discovering-symbols


67-67: Property Colopl\Spanner\Connection::$spannerClient has unknown class Google\Cloud\Spanner\SpannerClient as its type. (class.notFound)
Learn more at https://phpstan.org/user-guide/discovering-symbols


72-72: Property Colopl\Spanner\Connection::$spannerDatabase has unknown class Google\Cloud\Spanner\Database as its type. (class.notFound)
Learn more at https://phpstan.org/user-guide/discovering-symbols


82-82: Property Colopl\Spanner\Connection::$authCache has unknown class Psr\Cache\CacheItemPoolInterface as its type. (class.notFound)
Learn more at https://phpstan.org/user-guide/discovering-symbols


87-87: Property Colopl\Spanner\Connection::$sessionPool has unknown class Google\Cloud\Spanner\Session\SessionPoolInterface as its type. (class.notFound)
Learn more at https://phpstan.org/user-guide/discovering-symbols


97-97: Parameter $authCache of method Colopl\Spanner\Connection::__construct() has invalid type Psr\Cache\CacheItemPoolInterface. (class.notFound)


97-97: Parameter $authCache of method Colopl\Spanner\Connection::__construct() has invalid type Psr\Cache\CacheItemPoolInterface. (class.notFound)


97-97: Parameter $sessionPool of method Colopl\Spanner\Connection::__construct() has invalid type Google\Cloud\Spanner\Session\SessionPoolInterface. (class.notFound)


97-97: Parameter $sessionPool of method Colopl\Spanner\Connection::__construct() has invalid type Google\Cloud\Spanner\Session\SessionPoolInterface. (class.notFound)


102-102: Colopl\Spanner\Connection::__construct() calls parent::__construct() but Colopl\Spanner\Connection does not extend any class. (class.noParent)


109-109: Method Colopl\Spanner\Connection::getSpannerClient() has invalid return type Google\Cloud\Spanner\SpannerClient. (class.notFound)


109-109: PHPDoc tag @throws with type Google\Cloud\Core\Exception\GoogleException is not subtype of Throwable (throws.notThrowable)


116-116: Instantiated class Google\Cloud\Spanner\SpannerClient not found. (class.notFound)
Learn more at https://phpstan.org/user-guide/discovering-symbols


124-124: Method Colopl\Spanner\Connection::getSpannerDatabase() has invalid return type Google\Cloud\Spanner\Database. (class.notFound)


124-124: Method Colopl\Spanner\Connection::getSpannerDatabase() has invalid return type Google\Cloud\Spanner\Database. (class.notFound)


133-133: Method Colopl\Spanner\Connection::getDatabaseContext() has invalid return type Google\Cloud\Spanner\Database. (class.notFound)


133-133: Method Colopl\Spanner\Connection::getDatabaseContext() has invalid return type Google\Cloud\Spanner\Database. (class.notFound)


133-133: Method Colopl\Spanner\Connection::getDatabaseContext() has invalid return type Google\Cloud\Spanner\Transaction. (class.notFound)


133-133: Method Colopl\Spanner\Connection::getDatabaseContext() has invalid return type Google\Cloud\Spanner\Transaction. (class.notFound)


149-149: Method Colopl\Spanner\Connection::reconnect() has no return type specified. (missingType.return)


156-156: Access to an undefined property Colopl\Spanner\Connection::$database. (property.notFound)
Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property


156-156: Call to method connect() on an unknown class Google\Cloud\Spanner\SpannerClient. (class.notFound)
Learn more at https://phpstan.org/user-guide/discovering-symbols


162-162: Method Colopl\Spanner\Connection::reconnectIfMissingConnection() has no return type specified. (missingType.return)


172-172: Method Colopl\Spanner\Connection::disconnect() has no return type specified. (missingType.return)


175-175: Call to method close() on an unknown class Google\Cloud\Spanner\Database. (class.notFound)
Learn more at https://phpstan.org/user-guide/discovering-symbols


187-187: Call to an undefined method Colopl\Spanner\Query\Grammar::setConnection(). (method.notFound)


188-188: Call to an undefined method Colopl\Spanner\Connection::withTablePrefix(). (method.notFound)


199-199: Call to an undefined method Colopl\Spanner\Schema\Grammar::setConnection(). (method.notFound)


200-200: Call to an undefined method Colopl\Spanner\Connection::withTablePrefix(). (method.notFound)


210-210: Access to an undefined property Colopl\Spanner\Connection::$schemaGrammar. (property.notFound)
Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property


211-211: Call to an undefined method Colopl\Spanner\Connection::useDefaultSchemaGrammar(). (method.notFound)


214-214: Class Colopl\Spanner\Schema\Builder does not have a constructor and must be instantiated without any parameters. (new.noConstructor)


229-229: Method Colopl\Spanner\Connection::table() has parameter $as with no type specified. (missingType.parameter)


229-229: Method Colopl\Spanner\Connection::table() has parameter $table with no type specified. (missingType.parameter)


231-231: Call to an undefined method Colopl\Spanner\Query\Builder::from(). (method.notFound)


240-240: Call to an undefined method Colopl\Spanner\Connection::getPostProcessor(). (method.notFound)


240-240: Call to an undefined method Colopl\Spanner\Connection::getQueryGrammar(). (method.notFound)


240-240: Class Colopl\Spanner\Query\Builder does not have a constructor and must be instantiated without any parameters. (new.noConstructor)


246-246: Method Colopl\Spanner\Connection::select() has parameter $bindings with no type specified. (missingType.parameter)


246-246: Method Colopl\Spanner\Connection::select() has parameter $query with no type specified. (missingType.parameter)


246-246: Method Colopl\Spanner\Connection::select() has parameter $useReadPdo with no type specified. (missingType.parameter)


254-254: Method Colopl\Spanner\Connection::cursor() has parameter $bindings with no type specified. (missingType.parameter)


254-254: Method Colopl\Spanner\Connection::cursor() has parameter $query with no type specified. (missingType.parameter)


254-254: Method Colopl\Spanner\Connection::cursor() has parameter $useReadPdo with no type specified. (missingType.parameter)


267-267: Call to an undefined method Colopl\Spanner\Connection::run(). (method.notFound)


268-268: Call to an undefined method Colopl\Spanner\Connection::pretending(). (method.notFound)


282-282: Call to an undefined method Colopl\Spanner\Connection::run(). (method.notFound)


283-283: Call to an undefined method Colopl\Spanner\Connection::pretending(). (method.notFound)


292-292: Method Colopl\Spanner\Connection::statement() has parameter $bindings with no type specified. (missingType.parameter)


292-292: Method Colopl\Spanner\Connection::statement() has parameter $query with no type specified. (missingType.parameter)


313-313: Method Colopl\Spanner\Connection::affectingStatement() has parameter $bindings with no type specified. (missingType.parameter)


313-313: Method Colopl\Spanner\Connection::affectingStatement() has parameter $query with no type specified. (missingType.parameter)


317-317: Call to an undefined method Colopl\Spanner\Connection::run(). (method.notFound)


318-318: Call to an undefined method Colopl\Spanner\Connection::pretending(). (method.notFound)


334-334: Call to an undefined method Colopl\Spanner\Connection::pretending(). (method.notFound)


349-349: Method Colopl\Spanner\Connection::unprepared() has parameter $query with no type specified. (missingType.parameter)


357-357: Method Colopl\Spanner\Connection::getDatabaseName() has no return type specified. (missingType.return)


359-359: Call to method name() on an unknown class Google\Cloud\Spanner\Database. (class.notFound)
Learn more at https://phpstan.org/user-guide/discovering-symbols


367-367: Method Colopl\Spanner\Connection::setDatabaseName() has parameter $database with no type specified. (missingType.parameter)


407-407: Method Colopl\Spanner\Connection::prepareBindings() has no return type specified. (missingType.return)


409-409: Call to an undefined method Colopl\Spanner\Connection::getQueryGrammar(). (method.notFound)


418-418: Parameter $grammar of method Colopl\Spanner\Connection::prepareBinding() has invalid type Illuminate\Database\Query\Grammars\Grammar. (class.notFound)


420-420: Class Illuminate\Contracts\Support\Arrayable not found. (class.notFound)
Learn more at https://phpstan.org/user-guide/discovering-symbols


421-421: Call to method toArray() on an unknown class Illuminate\Contracts\Support\Arrayable. (class.notFound)
Learn more at https://phpstan.org/user-guide/discovering-symbols


428-428: Instantiated class Google\Cloud\Spanner\Timestamp not found. (class.notFound)
Learn more at https://phpstan.org/user-guide/discovering-symbols


446-446: Method Colopl\Spanner\Connection::escape() has no return type specified. (missingType.return)


446-446: Method Colopl\Spanner\Connection::escape() has parameter $binary with no type specified. (missingType.parameter)


450-450: Colopl\Spanner\Connection::escape() calls parent::escape() but Colopl\Spanner\Connection does not extend any class. (class.noParent)


474-474: Method Colopl\Spanner\Connection::escapeBool() has no return type specified. (missingType.return)


474-474: Method Colopl\Spanner\Connection::escapeBool() has parameter $value with no type specified. (missingType.parameter)


482-482: Method Colopl\Spanner\Connection::escapeString() has no return type specified. (missingType.return)


482-482: Method Colopl\Spanner\Connection::escapeString() has parameter $value with no type specified. (missingType.parameter)


492-492: Method Colopl\Spanner\Connection::runQueryCallback() has no return type specified. (missingType.return)


492-492: Method Colopl\Spanner\Connection::runQueryCallback() has parameter $bindings with no type specified. (missingType.parameter)


492-492: Method Colopl\Spanner\Connection::runQueryCallback() has parameter $query with no type specified. (missingType.parameter)


505-505: Caught class Google\Cloud\Core\Exception\AbortedException not found. (class.notFound)
Learn more at https://phpstan.org/user-guide/discovering-symbols


506-506: Throwing object of an unknown class Google\Cloud\Core\Exception\AbortedException. (class.notFound)
Learn more at https://phpstan.org/user-guide/discovering-symbols


513-513: Instantiated class Illuminate\Database\QueryException not found. (class.notFound)
Learn more at https://phpstan.org/user-guide/discovering-symbols


513-513: Throwing object of an unknown class Illuminate\Database\QueryException. (class.notFound)
Learn more at https://phpstan.org/user-guide/discovering-symbols


514-514: Call to an undefined method Colopl\Spanner\Connection::getName(). (method.notFound)


549-549: PHPDoc tag @throws with type Google\Cloud\Core\Exception\AbortedException|Google\Cloud\Core\Exception\NotFoundException|InvalidArgumentException is not subtype of Throwable (throws.notThrowable)


589-589: Call to method execute() on an unknown class Google\Cloud\Spanner\Transaction. (class.notFound)
Learn more at https://phpstan.org/user-guide/discovering-symbols


593-593: Call to method snapshot() on an unknown class Google\Cloud\Spanner\Database. (class.notFound)
Learn more at https://phpstan.org/user-guide/discovering-symbols


596-596: Call to method execute() on an unknown class Google\Cloud\Spanner\Database. (class.notFound)
Learn more at https://phpstan.org/user-guide/discovering-symbols


606-606: Call to method batch() on an unknown class Google\Cloud\Spanner\SpannerClient. (class.notFound)
Learn more at https://phpstan.org/user-guide/discovering-symbols


607-607: Access to an undefined property Colopl\Spanner\Connection::$database. (property.notFound)
Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property


623-623: Parameter $transaction of method Colopl\Spanner\Connection::executeDml() has invalid type Google\Cloud\Spanner\Transaction. (class.notFound)


623-623: Parameter $transaction of method Colopl\Spanner\Connection::executeDml() has invalid type Google\Cloud\Spanner\Transaction. (class.notFound)


625-625: Call to method executeUpdate() on an unknown class Google\Cloud\Spanner\Transaction. (class.notFound)
Learn more at https://phpstan.org/user-guide/discovering-symbols


626-626: Call to an undefined method Colopl\Spanner\Connection::recordsHaveBeenModified(). (method.notFound)


636-636: Parameter $transaction of method Colopl\Spanner\Connection::executeBatchDml() has invalid type Google\Cloud\Spanner\Transaction. (class.notFound)


636-636: Parameter $transaction of method Colopl\Spanner\Connection::executeBatchDml() has invalid type Google\Cloud\Spanner\Transaction. (class.notFound)


638-638: Call to method executeUpdateBatch() on an unknown class Google\Cloud\Spanner\Transaction. (class.notFound)
Learn more at https://phpstan.org/user-guide/discovering-symbols


644-644: Instantiated class Google\Cloud\Core\Exception\ConflictException not found. (class.notFound)
Learn more at https://phpstan.org/user-guide/discovering-symbols


644-644: Throwing object of an unknown class Google\Cloud\Core\Exception\ConflictException. (class.notFound)
Learn more at https://phpstan.org/user-guide/discovering-symbols


653-653: Call to an undefined method Colopl\Spanner\Connection::recordsHaveBeenModified(). (method.notFound)


689-689: Class Illuminate\Database\QueryException not found. (class.notFound)
Learn more at https://phpstan.org/user-guide/discovering-symbols


690-690: Call to method getPrevious() on an unknown class Illuminate\Database\QueryException. (class.notFound)
Learn more at https://phpstan.org/user-guide/discovering-symbols


693-693: Class Google\Cloud\Core\Exception\NotFoundException not found. (class.notFound)
Learn more at https://phpstan.org/user-guide/discovering-symbols


694-694: Call to method getMessage() on an unknown class Google\Cloud\Core\Exception\NotFoundException. (class.notFound)
Learn more at https://phpstan.org/user-guide/discovering-symbols

Additional comments not posted (4)
src/Query/Concerns/UsesSnapshot.php (1)

45-48: The method snapshotEnabled is correctly implemented.

src/Query/Builder.php (2)

32-32: The integration of the UsesSnapshot trait is correctly implemented.


193-196: The updates to the runSelect method to support snapshot queries are correctly implemented.

src/Connection.php (1)

581-595: The modifications in the executeQuery method to support snapshot queries are correctly implemented.

Tools
PHPStan

589-589: Call to method execute() on an unknown class Google\Cloud\Spanner\Transaction. (class.notFound)
Learn more at https://phpstan.org/user-guide/discovering-symbols


593-593: Call to method snapshot() on an unknown class Google\Cloud\Spanner\Database. (class.notFound)
Learn more at https://phpstan.org/user-guide/discovering-symbols

Comment on lines 33 to 40
public function useSnapshot(?TimestampBoundInterface $timestampBound = null): static
{
$this->useSnapshot = true;
if ($timestampBound !== null) {
$this->withStaleness($timestampBound);
}
return $this;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Undefined method withStaleness used in useSnapshot.

Please ensure that withStaleness is defined or properly inherited. If it's part of another trait or class, consider using PHPDoc @method tag to clarify its availability.

@matthewjumpsoffbuildings
Copy link
Contributor

@taka-oyama anything I can do to help this PR be ready for merge?

@taka-oyama
Copy link
Collaborator Author

Unfortunately, I'm going to be on paternity leave for about a month, so I won't be able to work on this until august.

The reason there is no progress here is because I tried to use SingleUse Transaction to implement this, but there seems to be a bug in google/cloud-spanner which causes all queries running as SingleUse to throws an error. This needs to be resolved first and I haven't gotten around to creating a issue in https://github.com/googleapis/google-cloud-php.

@matthewjumpsoffbuildings
Copy link
Contributor

there seems to be a bug in google/cloud-spanner which causes all queries running as SingleUse to throws an error.

Is this just in the emulator? Or on real Spanner instances too?

@matthewjumpsoffbuildings
Copy link
Contributor

@taka-oyama any updates on this PR?

@taka-oyama taka-oyama requested a review from a team September 6, 2024 09:08
@taka-oyama taka-oyama marked this pull request as ready for review September 6, 2024 09:09
Copy link
Contributor

@halnique halnique left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost LGTM.

src/Connection.php Outdated Show resolved Hide resolved
@taka-oyama taka-oyama merged commit 72c61a5 into master Sep 18, 2024
1 check passed
@taka-oyama taka-oyama deleted the feature/snapshot branch September 18, 2024 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Snapshots
3 participants